Getting a FB user location with RestFB
I am trying to retrieve the user's Hometown location using the RestFB. Here is the code :
t.facebookClient=new DefaultFacebookClient("mqJHZiRx7W3Z9QdDu");
User user=t.facebookClient.fetchObject("100001108623365", User.class);
System.out.开发者_如何学编程println(user.getHometownName());
However even if the FB page lists the home location, the FB API returns null. I am submitting a valid OAuth token.
How can i get this information? If this is not possible can i retrieve the geolocation of a Post object instead?
Thank you in advance
Double check that you have the user_hometown permission for the user.
Incase you are doing a server side authentication,
http://developers.facebook.com/docs/authentication/server-side/ will give you an idea about how to carry out the OAuth2.0 authentication.
The following link will give take you to the permissions page in facebook
http://developers.facebook.com/docs/authentication/permissions/
Make sure you give in the necessary permissions in the scope of the while performing the GET request.
精彩评论