简体   繁体   English

获取朋友列出Android中的空Facebook SDK 3.8

[英]Getting Friends List Empty Facebook SDK 3.8 in Android

I am trying to fetch friends' list in Facebook SDK 3.8 but it returning Empty User List . 我正在尝试在Facebook SDK 3.8获取朋友列表,但返回的是“ Empty User List I have also set the permissions of user_friends . 我还设置了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 . 我将UserListSize0 What am I missing? 我想念什么?

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. 如果您是在2014年4月30日之后创建的应用,则说明您使用的是图API的2.0版,在这种情况下,newMyFriendsRequest将仅返回也在使用您的应用的朋友。 You should also update your SDK to the latest (3.14.1). 您还应该将SDK更新到最新版本(3.14.1)。

In facebook api v2.0 has no way to get all friends list. 在facebook api v2.0中无法获取所有好友列表。 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. 邀请好友列表:您可以使用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 https://developers.facebook.com/docs/graph-api/reference/v2.0/user/taggable_friends

for more detail please read facebook change log: 有关更多详细信息,请阅读facebook更改日志:

Facebook Change log Facebook更改日志

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM