简体   繁体   English

Android Facebook SDK获取朋友列表

[英]Android Facebook SDK get friend list

I want to get user's who is logged into my app friend list. 我想获取已登录我的应用程序好友列表的用户。 So, I need to use this code to do that: 因此,我需要使用以下代码来做到这一点:

new GraphRequest(
    AccessToken.getCurrentAccessToken(),
    "/me/friends",
    null,
    HttpMethod.GET,
    new GraphRequest.Callback() {
        public void onCompleted(GraphResponse response) {
            /* handle the result */
        }
    }
).executeAsync();

The problem is that I don't know what I need to write into onCompleted method to put friend list to array. 问题是我不知道我需要写什么到onCompleted方法中以将好友列表放入数组。

after the data comes to onCompleted() you can do something like this to see the structure of the json response, 在数据到达onCompleted()之后,您可以执行以下操作以查看json响应的结构,

Log.d("-@-", "graph response " + response.getJSONObject()); Log.d(“-@-”,“图形响应” + response.getJSONObject());

this gives the structure of the json object from there you can get the data. 这给出了json对象的结构,您可以从那里获取数据。 Also i think your app needs to go through facebook submission as there is other permissions your app needs to get friends of a person 我也认为您的应用程序需要通过Facebook提交,因为您的应用程序还需要其他权限才能结识一个人

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

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