Gracenote GNSDK is not retrieving genre on Android

2019-09-06 18:54发布

问题:

I'm studiyng gracenote gnsdk in an android application. With the developer key I have, I can retrieve basic information about the music, but I can't retrieve info such as mood and genre.

Does anyone knows a way to get this information? I'm following the example, like this:

String genre = gnAlbum.trackMatched().genre(GnDataLevel.kDataLevel_1);
if(genre == null || genre.isEmpty()){
    genre = gnAlbum.genre(GnDataLevel.kDataLevel_1);
}

Thanks in advance!

回答1:

according to the docs you have to load a locale object to get genre results, e.g.

mGnLocale = new GnLocale(GnLocaleGroup.kLocaleGroupMusic, GnLanguage.kLanguageEnglish, GnRegion.kRegionGlobal, GnDescriptor.kDescriptorDefault, mGnUser);
mGnLocale.setGroupDefault();

this takes quite a while so you might want to run that in a separate thread.