Get Google Plus friends Android

流过昼夜 提交于 2019-12-08 13:24:54

问题


I am working with google + getting friends. I can successfully log in and get my credentials. But when I use mPlusClient.loadPeople(this, "me");, the return of

@Override
    public void onPeopleLoaded(ConnectionResult status, PersonBuffer personBuffer, String nextPageToken) {
        switch (status.getErrorCode()) {

        case ConnectionResult.SUCCESS:
            try {
                int count = personBuffer.getCount();
                Log.e("", "count : " + count);
                for (int i = 0; i < count; i++) {
                    Log.e("NAME", "" + personBuffer.get(i).getDisplayName());
                }
            } finally {
                personBuffer.close();
            }

            break;

        case ConnectionResult.SIGN_IN_REQUIRED:
            mPlusClient.disconnect();
            mPlusClient.connect();
            break;

        default:
            Log.e("TAG", "Error when listing people: " + status);
            break;
        }
    }

is only the details of the logged in user. Now what I what to achieve is to get the list of my friends. I tried using

mPlusClient.loadPeople(MainActivity.this, Person.Collection.Visible);

but it says "Collection cannot be resolved or is not a field". Any help would be highly appreciated. Thank you.


回答1:


Looks like you're after the PlusClient.loadVisiblePeople method.

You can see an example of the response using Web API explorer.




回答2:


This link somehow helped me to feftch the members of my circle in google plus.

mPlusClient.loadVisiblePeople(this, null);

solved the problem. People.Collection.VISIBLE is not already working. I do not know why.



来源:https://stackoverflow.com/questions/21326874/get-google-plus-friends-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!