2

I am trying to get person's user name with facebook graph user object. It gives firstname, lastname and other details correctly but gives null when I call getUserName().

public void onCompleted(GraphUser user, Response response) {
              if (user != null) {

                //facebook authentication done.
                //Disable login button

                Log.d("From FB", user.getFirstName());
                Log.d("From FB", user.getLastName());
                Log.d("From FB", user.getId());
                Log.d("From FB", user.getProperty("email").toString());
                Log.d("From FB", user.getUsername());//gives null

Is there any other way to get the person's userName? Please let me know how to get person's user name.

thanks

codeomnitrix
  • 4,179
  • 19
  • 66
  • 102

1 Answers1

3

The username field is no longer available with the Graph API v2.0. Refer

https://developers.facebook.com/docs/apps/changelog#v2_0_graph_api https://developers.facebook.com/docs/graph-api/reference/v2.0/user/#fields

Mukesh Rana
  • 4,051
  • 3
  • 27
  • 39
  • thanks mukesh, can you please help me how i can get user's profile pic in this case? – codeomnitrix Nov 01 '14 at 13:10
  • 1
    just replace your fb_id and height and width of picture in this url http://graph.facebook.com/facebookId/picture?width=picWidth&height=picHeight – Mukesh Rana Nov 01 '14 at 13:14