我正在使用facebook sdk 4.4.0。
现在,当我获取当时正在使用我的应用的朋友列表时,我需要检索他们的email
。但我没有得到它。
GraphRequestBatch batch = new GraphRequestBatch(
GraphRequest.newMyFriendsRequest(token,
new GraphRequest.GraphJSONArrayCallback() {
@Override
public void onCompleted(JSONArray jsonArray,
GraphResponse response) {
System.out.println("jsonArray: "
+ jsonArray);
System.out.println("GraphResponse: "
+ response);
try {
mArrayUserFriendsList = new ArrayList<UserFriendsList>();
for (int i = 0; i < jsonArray.length(); i++) {
mFriendsList = new FriendsList();
JSONObject c = jsonArray
.getJSONObject(i);
mFriendsList.setname(c
.getString("email"));
mArrayFriendsList.add(mFriendsList);
mUFriendsListAdapter = new UFriendsListAdapter(
getActivity(), mArrayFriendsList);
user_friends
.setAdapter(mFriendsListAdapter);
mFriendsListAdapter
.notifyDataSetChanged();
}
} catch (JSONException e) {
e.printStackTrace();
}
}
}), GraphRequest.newMeRequest(token,
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object,
GraphResponse response) {
System.out.println("meJSONObject: "
+ object);
System.out.println("meGraphResponse: "
+ response);
}
}));
batch.addCallback(new GraphRequestBatch.Callback() {
@Override
public void onBatchCompleted(GraphRequestBatch graphRequests) {
// Log.i(TAG, "onCompleted: graphRequests "+ graphRequests);
}
});
batch.executeAsync();
Bundle parameters = new Bundle();
parameters.putString("fields",
"id,first_name,email,gender,birthday");
// request.setParameters(parameters);
// request.executeAndWait();
当我写name
而不是email
时,它会给我一个朋友列表的名称。
如何获取电子邮件信息?