我最初使用的是loginButton.setReadPermissions( "user_friends");
,但我将其权限更改为loginButton.setReadPermissions( Arrays.asList("public_profile, email, user_birthday,user_friends"));
。现在我无法从用户配置文件中获取必填字段并且在logcat中收到此错误无法使用现有的AccessToken设置其他权限。
修改
protected void onCurrentAccessTokenChanged(AccessToken old, AccessToken newToken) {
final ProgressDialog pDialog = new ProgressDialog(getActivity());
GraphRequest request = GraphRequest.newMeRequest(
newToken,
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject object,
GraphResponse response) {
// Application code
pDialog.dismiss();
Log.v("LoginActivity", response.toString());
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender, birthday");
request.setParameters(parameters);
pDialog.setMessage("Loading Channels....");
pDialog.setIndeterminate(false);
pDialog.setCancelable(true);
pDialog.show();
request.executeAsync();
}
};
生日和电子邮件地址无效。我该如何取这两个?提前谢谢。
答案 0 :(得分:1)
您无需重新验证基本信息,例如公开个人资料,用户朋友和电子邮件。您可以在成功登录后发送图表请求,
GraphRequest request = GraphRequest.newMeRequest(
AccessToken.getCurrentAccessToken(),new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(JSONObject object,GraphResponse response) {
try {
String email=object.getString("email");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
request.executeAsync();
但是为了获得B'day,您必须提交应用以供审核,请在此处阅读description