5

I want to get list of people info from google plus in my app: friends profile image URL, visible name and id.

Here's an official google plus integrating tutorial. I make the test app by this tutorial and trapped on error:

Error requesting visible circles: Status{statusCode=NETWORK_ERROR, resolution=null}

Implementing the Google Api Client:

mGoogleApiClient = new GoogleApiClient.Builder(this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .addApi(Plus.API, null)
            .addScope(Plus.SCOPE_PLUS_PROFILE)
            .addScope(Plus.SCOPE_PLUS_LOGIN)
            .build();

Here's onResult:

@Override
public void onResult(People.LoadPeopleResult loadPeopleResult) {

    if (loadPeopleResult.getStatus().getStatusCode() == CommonStatusCodes.SUCCESS) {
        PersonBuffer personBuffer = loadPeopleResult.getPersonBuffer();
        try {
            int count = personBuffer.getCount();
            for (int i = 0; i < count; i++) {
                Log.d("TEST", "Display name: " + personBuffer.get(i).getDisplayName());
            }
        } finally {
            personBuffer.close();
        }
    } else {
        Log.e("TEST", "Error requesting visible circles: " + loadPeopleResult.getStatus());
    }
}

And the permissions into AndroidManifest.xml:

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.USE_CREDENTIALS" />

Please help me, what I need to do?

Ravi Bhandari
  • 4,682
  • 8
  • 40
  • 68
david_rbk
  • 71
  • 1
  • 6
  • Just to check, did the sign in process succeed - did you get the consent screen and successfully get the onConnected callback? – Ian Barber Mar 17 '14 at 17:31
  • @IanBarber Sign in is succeed, but not able to fetch the people - this is the problem. – david_rbk Mar 21 '14 at 11:21
  • 2
    Some things to check: is the app really connected (does it turn up on plus.google.com/apps for the user after they have signed in) - if not could be a problem with the client ID in the developer console not matching the project signing key. Second: is the user a google apps user with G+ disabled. Third: can you make other API calls (e.g. retrieve the profile for the current user). – Ian Barber Mar 21 '14 at 12:21

1 Answers1

1

I've fixed it! My problem was: I do not have specify package correctly: like this com.example but correct way is com.example.moduledir

david_rbk
  • 71
  • 1
  • 6