As you stated, the following command
fb.fetchObject(fb.userOperations().getUserProfile().getLocation().getId(), org.springframework.social.facebook.api.Location.class)
gives the answer to the name that is in the link.
It has 2 public methods: getId() and getName() .
Some methods, such as getLocation() , are permission dependent. If any user gives you permission to view their location, you can access this method.
From the documentation:
getLocation
public Link getLocation ()
User location. Available only with the permissions of "user_location" or "friends_location".
Returns: a Link to the user's location, if available
Code example:
Page profile=facebookTemplate.pageOperations().getPage(id); String name=profile.getName(); String webside=profile.getWebsite(); String logo="http://graph.facebook.com/" + id + "/picture"; party=new FullPoliticalParty(name,color,logo,webside); String phone=profile.getPhone() == null ? "No disponible" : profile.getPhone(); party.setPhone(phone); org.springframework.social.facebook.api.Location loc=profile.getLocation(); if (loc != null) { location=new LocationMapa(loc.getCity(),loc.getCountry(),loc.getStreet(),loc.getZip()); } party.setLocation(location);
Link to the resource:
Update1:
I think you need user rights through the Graph API. You can then access the location or other information that you requested from a specific user. Checking Current Permissions and Handling Missing Permissions are given in this link .
For USER user rights:
new GraphRequest( AccessToken.getCurrentAccessToken(), "/{user-id}/permissions", null, HttpMethod.GET, new GraphRequest.Callback() { public void onCompleted(GraphResponse response) { } } ).executeAsync();
For user permissions you can go through this tutorial.
For the user's location, you can go through this tutorial .
Once you get permission, you can also access location, longitude, latitude, and other information.