I think the return value from facebook is ambiguous.:
loginButton.registerCallback(callbackManager, new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
GraphRequest request = GraphRequest.newMeRequest(
loginResult.getAccessToken(),
new GraphRequest.GraphJSONObjectCallback() {
@Override
public void onCompleted(
JSONObject object,
GraphResponse response) {
// Application code
try {
JSONObject jsonObject = new JSONObject(response.toString());
} catch (JSONException e) {
e.printStackTrace();
}catch (NullPointerException e){
}
}
});
Bundle parameters = new Bundle();
parameters.putString("fields", "id,name,email,gender, birthday");
request.setParameters(parameters);
request.executeAsync();
}
@Override
public void onCancel() {
Log.e("facebook","canceled");
}
@Override
public void onError(FacebookException e) {
Log.e("facebook error",e.getMessage().toString());
}
});
result :
{Response: responseCode: 200, graphObject: {"id":"931177080295510","birthday":"06\/24\/1991","gender":"male","email":"smemamian@yahoo.com","name":"Masoud Emamian"}, error: null}
how to parse it ?