0

I have the facebook id of an user, can I get information from its profile like the name in my android application?

Lucas
  • 69
  • 7
  • Check the following answer: http://stackoverflow.com/a/15647007/5828664, it is fully and well explained. – Amesys May 12 '16 at 20:40
  • Try this http://stackoverflow.com/questions/37183258/how-to-get-email-from-facebook-sdk-4-0/37183573#37183573 – Vanraj Ghed May 13 '16 at 04:29

1 Answers1

0

I just found out the solution:

GraphResponse response = new GraphRequest(
        AccessToken.getCurrentAccessToken(),
        "/" + id,
        null,
        HttpMethod.GET,
        new GraphRequest.Callback() {
            public void onCompleted(GraphResponse response) {
            }
        }
    ).executeAndWait();

    JSONObject json = response.getJSONObject();
    try {
        String name = json.getString("name");
    }catch(JSONException e){
        e.printStackTrace();
    }
Lucas
  • 69
  • 7