0
我想在我的Android项目中获取带性别的Facebook朋友列表。 我的代码;如何在Android中使用Graph API获取Facebook性别的朋友列表?
new GraphRequest(
AccessToken.getCurrentAccessToken(),
"/"+ AccessToken.getCurrentAccessToken().getUserId()+"/taggable_friends",
null,
HttpMethod.GET,
new GraphRequest.Callback() {
public void onCompleted(GraphResponse response) {
try {
JSONObject jsonObjectData = response.getJSONObject();
JSONArray jsonArrayData = jsonObjectData.getJSONArray("data");
personList = new ArrayList<Person>();
for (int i = 0; i < jsonArrayData.length(); i++) {
JSONObject jsonObjectPerson = jsonArrayData.getJSONObject(i);
Person person = new Person();
person.setId(jsonObjectPerson.optString("id"));
person.setName(jsonObjectPerson.optString("name"));
personList.add(person);
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}
).executeAsync();
此方法返回给我3个参数; ID
,NAME
和PICTURE
。我尝试将endPoint
更改为"/friends"
,但此时数据为空。当我尝试使用FQL
时,我收到此消息:
“fql在版本v2.1和更高版本中已弃用”。
我如何获得Facebook性别的朋友列表?
taggable_friends仅用于标记人员,您不得将其用于任何其他目的。 – CBroe