Open LucasArgate opened 7 years ago
@LucasArgate You need to wrap spotify.getMe() in a separate thread. I would recommend using Androids asyncTask class to call all network operations, and then overriding the onPostExecute method to use the UserInfo data for whatever you need. IE:
public UserPrivate fetchUserInfo() { new AsyncTask<Void, Void, UserPrivate>() {
@Override
protected UserPrivate doInBackground(Void... voids) {
UserPrivate userPrivate = null;
try {
userPrivate = mService.getMe();
} catch (Exception e) {
Log.e(TAG, "Error fetching UserInfo: " + e);
}
return userPrivate;
}
@Override
protected void onPostExecute(UserPrivate userPrivate) {
// Do what you need to with user data
}
}.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR);
}
Hello guys, when i use this command:
UserPrivate user = spotify.getMe();
i get the error:
Before this, i get correcly service:
What i doing wrong ?
thanks!