1
votes

I have implemented the following code from google in my android app but always l get zero person from persobuffer. l don't know why.

Let me show some details

on public void onconnected() l call

Plus.PeopleApi.loadVisible(mGoogleApiClient, null).setResultCallback(this);// also l tried Plus.PeopleApi.loadVisible(mGoogleApiClient, "me").setResultCallback(this);

l have enable the google+ api in console developers and l had create the appropriate key

l have implement the ResultCallback method in my activity

l use the following function to receive the data and l don't get any error from logcat

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());

                friends.add(personBuffer.get(i).getDisplayName());
            }
        } finally {
            personBuffer.close();

        }
    } else {
        Log.e("TEST", "Error requesting visible circles: " + loadPeopleResult.getStatus());
    }
}

Also l made my circles visible to anyone and l gave permissions to my app to see my circles but the personBuffer.getCount() returns always zero.

1
This code works for me - n00b
Have you resolved issue ? - Hiren Patel

1 Answers

0
votes

Did you put in your manifest the correct permission

Something like:

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