我必须获取不在我朋友列表中的 Facebook 用户的姓名、身份证、性别、年龄位置、兴趣、生日。
目前我只得到用户的姓名、身份证和性别。谁能告诉我如何访问其他参数...??
我的代码是
Request req = new Request(session, facebookID, params, HttpMethod.GET, new Request.Callback() {
@Override
public void onCompleted(Response facebookUserResponse) {
System.out.println("Facebook User Response is: "+ facebookUserResponse);
GraphObject facebookUserResponseGraphObject = facebookUserResponse.getGraphObject();
JSONObject facebookUserResponseJSONObject = facebookUserResponseGraphObject.getInnerJSONObject();
String gender = null;
String birthday = null;
String timezone = null;
String hometown = null;
String location = null;
String age_range_min = null;
String age_range_max = null;
try{
gender = facebookUserResponseJSONObject.getString("gender");
}
catch (JSONException e) {
e.printStackTrace();
gender = null;
}
try{
birthday = facebookUserResponseJSONObject.getString("birthday");
}
catch (JSONException e) {
e.printStackTrace();
birthday = null;
}
try{
timezone = facebookUserResponseJSONObject.getString("timezone");
}
catch (JSONException e) {
e.printStackTrace();
timezone = null;
}
try{
hometown = facebookUserResponseJSONObject.getJSONObject("hometown").getString("name");
}
catch (JSONException e) {
e.printStackTrace();
hometown = null;
}
try{
location = facebookUserResponseJSONObject.getJSONObject("location").getString("name");
}
catch (JSONException e) {
e.printStackTrace();
location = null;
}
try{
age_range_min = facebookUserResponseJSONObject.getJSONObject("age_range").getString("min");
}
catch (JSONException e) {
e.printStackTrace();
age_range_min = null;
}
try{
age_range_max = facebookUserResponseJSONObject.getJSONObject("age_range").getString("max");
}
catch (JSONException e) {
e.printStackTrace();
age_range_max = null;
}
}
});
Request.executeBatchAsync(req);