嗨,我正在玩新的 Facebook Android SDK。我不知道的一件事是我如何要求电子邮件地址。我尝试了以下操作,但它返回了除电子邮件地址之外的所有字段的值。我想我可能必须单独请求电子邮件地址的许可,但不确定如果我使用 LoginFragment 该怎么做。
Request request = Request.newMeRequest(session, new GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
profilePictureView.setUserId(user.getId());
userNameView.setText(user.getName());
}
});
String NAME = "name";
String ID = "id";
String PICTURE = "picture";
String EMAIL = "email";
String FIELDS = "fields";
String REQUEST_FIELDS = TextUtils.join(",", new String[] {
ID, NAME, PICTURE, EMAIL
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);
任何帮助表示赞赏。谢谢