从 android 中的 facebook sdk 4.0.1 获取好友列表,图表 api 2.2

fetch friends list from facebook sdk 4.0.1 in android with graph api 2.2

我在进行一些搜索后用于获取列表的代码如下

GraphRequestBatch batch = new GraphRequestBatch(
                GraphRequest.newMyFriendsRequest(
                        accessToken,
                        new GraphRequest.GraphJSONArrayCallback() {
                            @Override
                            public void onCompleted(
                                    JSONArray jsonArray,
                                    GraphResponse response) {
                                // Application code for users friends
                                System.out.println("getFriendsData onCompleted : jsonArray " + jsonArray);
                                System.out.println("getFriendsData onCompleted : response " + response);
                                try {
                                    JSONObject jsonObject = response.getJSONObject();
                                    System.out.println("getFriendsData onCompleted : jsonObject " + jsonObject);
                                    JSONObject summary = jsonObject.getJSONObject("summary");
                                    System.out.println("getFriendsData onCompleted : summary total_count - " + summary.getString("total_count"));
                                } catch (Exception e) {
                                    e.printStackTrace();
                                }
                            }
                        })

        );
        batch.addCallback(new GraphRequestBatch.Callback() {
            @Override
            public void onBatchCompleted(GraphRequestBatch graphRequests) {
                // Application code for when the batch finishes
            }
        });
        batch.executeAsync();

        Bundle parameters = new Bundle();
        parameters.putString("fields", "id,name,link,picture");

我得到的许可是 accessToken : {AccessToken token:ACCESS_TOKEN_REMOVED 权限:[user_friends, basic_info]}

getRecentlyGrantedPermissions : [user_friends, basic_info]

getRecentlyDeniedPermissions : []

图形函数的输出是-

response {Response: responseCode: 200, graphObject: {"summary":{"total_count":3},"data":[]}, 错误: null }

谁能指导我获取用户的好友列表。

提前致谢。

输出正确,none 位好友已授权您的应用。由于 Graph v2.0 API 出于隐私原因,您只能获得授权您的应用程序的朋友:https://developers.facebook.com/docs/graph-api/reference/v2.3/user/friends

更多信息可以在这个线程中找到:Get ALL User Friends Using Facebook Graph API - Android