I want to have a Google Plus login in my application. I could connect, but could not get information about the current user profile.
@Override public void onConnected() { String accountName = mPlusClient.getAccountName(); mPlusClient.loadPerson(this, "me"); } @Override public void onPersonLoaded(ConnectionResult status, Person person) { Log.d("onPersonLoaded - ConnectionResult", "" + status); Log.d("onPersonLoaded - person", "" + person); if (status.getErrorCode() == ConnectionResult.SUCCESS) { Log.d(TAG, "Display Name: " + person.getDisplayName()); } }
I could get the account name in onConnected But onPersonLoaded gives null for person
The logs show:
onPersonLoaded - ConnectionResult(29861): ConnectionResult{statusCode=NETWORK_ERROR, resolution=null} onPersonLoaded - person(29861): null
From the document here
public static final int NETWORK_ERROR
A network error has occurred. Retrying should fix the problem.
Constant value: 7 (0x00000007)
But I get the same error, no matter how many times I repeat. And this is the permission I use:
<uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" /> <uses-permission android:name="android.permission.READ_PROFILE" />
I have no idea how to resolve this and have been looking for the last 2 hours. Any help is greatly appreciated, thanks.
user1537779
source share