1

I'm building an app using the latest version of Facebook Android SDK, using their own tutorial, with the Facebook Login Button. After login I perform a call to the GraphAPI (as shown here https://developers.facebook.com/docs/graph-api/reference/user) but, the only thing I receive is the account name and id. I also tried to get the user profile information using this code:

GraphRequest request = GraphRequest.newMeRequest(AccessToken.getCurrentAccessToken(),
                    new GraphRequest.GraphJSONObjectCallback() {
                        @Override
                        public void onCompleted(JSONObject object, GraphResponse response) {
                            // My code
                        }
                    });

            request.executeAsync();

But the answer is always the same: only the user name and id. Am I missing something? I ask for public_profile and email permissions so, I'd like to see information as email, hometown and other things, just like the Graph object itself, according with the API. Has anyone seen something like this?

Thanks in advance

Hime
  • 369
  • 3
  • 15

1 Answers1

3

You got your request object, but do this before executeAsync():

Bundle parameters = new Bundle();
parameters.putString("fields", "id, first_name, last_name, email,gender, birthday, location");
request.setParameters(parameters);
request.executeAsync();

I found this here: Facebook Android SDK 4.5.0 get email address so try to improve your Googleing skills :D

Community
  • 1
  • 1
JoKr
  • 4,976
  • 8
  • 27
  • 39
  • 1
    So, I did Googled something but I didn't understand why I have to use these parameters very well. Also, I don't think the API is clear enough about this. Anyway, thanks for your help, it worked perfectly :) – Hime Mar 07 '16 at 00:19
  • @Gudin Actually, i found the link you posted on Google before [This Question](http://stackoverflow.com/questions/35833955/facebook-android-sdk-not-returning-all-profile-information?noredirect=1&lq=1). Thus, My Googleing skills is awesome. lol – Kenny Dabiri Dec 09 '16 at 19:44