如果用户在他们的联系人中有这些信息,那么他们也是在Facebook上与那个人的朋友。只需使用图形api并获取朋友列表,并使用所选联系人姓名对其进行筛选,或者让用户从由facebook api查询的返回名称构成的列表视图中进行选择。
try {
JSONObject response = Util.parseJson(facebook.request(
"/me/friends", new Bundle(), "GET"));
JSONArray jArray = response.getJSONArray("data");
for (int i = 0; i < jArray.length(); i++) {
JSONObject json_data = jArray.getJSONObject(i);
tempMap = new HashMap<String, Object>();
tempMap.put("friend", json_data.getString("name"));
tempMap.put("id", json_data.getString("id"));
friendlist.add(tempMap);
}
} catch (MalformedURLException e) {
e.printStackTrace();
} catch (JSONException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (FacebookError e) {
e.printStackTrace();
}
看来,Facebook限制了这些数据的权限。 – Janusz 2011-01-19 16:14:59