Search code examples
javaandroidgracenote

How to get Song coverArt in android using GracenoteApI ?


I am using gracenote ApI for song recognization.i am getting all the detail like song name,artist name and album but I am unable to get cover Art of album. I am using the code to get it but I always get null in that code. I searched a lot for this but found nothing. Somebody tells me that how to do this.i searched on gracenote documentation they describe the following code to get the coverArt.

                           // Retrieve cover art URL
                           // where response is GNSearchResult.
                GNCoverArt coverArt = response.getCoverArt();
                if(coverArt != null) {
                String coverArtUrl = coverArt.getUrl();

                }else {
                    Log.i("URL", "NOT GETTT");  
                }

I always get coverArt=null.


Solution

  • This looks like the Gracenote 'Mobile Client' SDK.

    To enable cover art, you need to set an option on the GNConfig object like this:

    config.setProperty("content.coverart", "1");
    

    I would also advise setting this to ensure that the response has what it needs to fetch the cover art (especially if you are getting results from a local 'bundle'):

    config.setProperty("content.allowfullresponse", "1");
    

    Hope this helps!