这是我的 facebook me request 代码。我想获取用户电子邮件和其他基本信息。此代码在模拟器中没有任何问题。但在真实设备中,电子邮件给出了 null 值。id,fristname... 带有真实值。如何在真实设备上获取电子邮件?
Request request = Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
RequestParams params = new RequestParams();
params.put("email",(String) user.getProperty("email"));
params.put("password", "");
params.put("facebook_id", user.getId());
editor.putString("facebook_id", user.getId());
login(params,
(String) user.asMap().get("email"),
user.getId(), user.getFirstName(),
user.getLastName());
}
}
});
Bundle params = new Bundle();
params.putString("fields", "id,email,first_name,last_name");
request.setParameters(params);
request.executeAsync();