Android Facebook friendsList array is null but FrindsList count is showing

牧云@^-^@ 提交于 2019-12-11 02:09:57

问题


My permissions:

facebookLoginButton.setReadPermissions(
    Arrays.asList("public_profile", "user_friends","read_friendlists"));

Callback functions:

new Request(Session.getActiveSession(), "/" + USER_ID + "/friends", null, HttpMethod.GET,
    new Request.Callback() {
        public void onCompleted(Response response) {
            showLogInfo("###########" + response.getRawResponse());
        }
    }).executeAsync();

This above function I'm calling to get facebook friends list. but I'm getting following response.

{"summary":{"total_count":342},"data":[]}

My doubt is I'm getting total count. but why can't I get data list ? Please someone help me to Identify my mistake. Thanks in Advance.


回答1:


It is not possible to get ALL friends with v2.0+, only with Apps created before end of April 2014 by using v1.0 of the Graph API. And it will only work until end of April 2015. See changelog for more information about the versions: https://developers.facebook.com/docs/apps/changelog

There is also invitable_friends and taggable_friends though, but they are reserved for Apps on facebook.com:

  • https://developers.facebook.com/docs/graph-api/reference/v2.1/user/invitable_friends
  • https://developers.facebook.com/docs/graph-api/reference/v2.1/user/taggable_friends

This may also be interesting for inviting friends: https://developers.facebook.com/docs/games/requests/v2.1

Here´s another thread where this is explained in a very detailed way: Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app




回答2:


New facebook graph api does not allow friend list access, you can only get count and Tagged friends

Check this link developers.facebook.com/docs/graph-api/reference/v2.1/user/ where it is clearly mentioned that

  • This will only return any friends who have used (via Facebook Login) the app making the request.

  • If a friend of the person declines the user_friends permission, that friend will not show up in the friend list for this person



来源:https://stackoverflow.com/questions/26361179/android-facebook-friendslist-array-is-null-but-frindslist-count-is-showing

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