Getting Friends List Empty Facebook SDK 3.8 in Android

人走茶凉 提交于 2019-12-10 12:19:31

问题


I am trying to fetch friends' list in Facebook SDK 3.8 but it returning Empty User List. I have also set the permissions of user_friends. Please see the following code.

<code>
    LoginButton loginButton = (LoginButton) findViewById(R.id.login_button);
    loginButton.setReadPermissions(Arrays.asList("user_friends"));

    Request request = Request.newMyFriendsRequest(session, new Request.GraphUserListCallback() {

                    @Override
                    public void onCompleted(List<GraphUser> users, Response response) {
                        Log.i("activitytag", "UserListSize: " + users.size());

                    }
                });
                request.executeAsync();
</code>

I am getting the UserListSize to 0. What am I missing?


回答1:


If you created your app after April 30, 2014, then you're using version 2.0 of the graph API, in which case the newMyFriendsRequest will only return friends who are also using your app. You should also update your SDK to the latest (3.14.1).




回答2:


In facebook api v2.0 has no way to get all friends list. but if you want to get all friend list ONLY IN GAME then you can call Either

Invitable Friends List: you may use the https://developers.facebook.com/docs/graph-api/reference/v2.0/user/invitable_friends API. OR Taggable Friends List:

the https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends

for more detail please read facebook change log:

Facebook Change log



来源:https://stackoverflow.com/questions/23759051/getting-friends-list-empty-facebook-sdk-3-8-in-android

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