在进行一些搜索之后用于获取列表的代码如下所示
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令牌:ACCESS_TOKEN_REMOVED权限:[user_friends,basic_info]}
getRecentlyGrantedPermissions:[user_friends,basic_info]
getRecentlyDeniedPermissions:[]
并且图形函数的输出是 –
响应{响应:responseCode:200,graphObject:{“summary”:{“total_count”:3},“data”:[]},错误:null}
所以任何人都可以指导我获取用户的好友列表.
提前完成.