I am having some troubles to get the location data from the end-user Facebook friends list on my Android application.
So far I can successfully open a Facebook Session, store & restore the access token and fetch the user friends list.
As defined in the Android Facebook SDK >3.0, a Facebook user data is strongly-typed in an Object called GraphUser
.
To fetch the Friends List, I user Request.newMyFriendsRequest
which, upon success, provides me with a list of GraphUsers
.
Unfortunately, though I provided the necessary permissions for my endeavor, I fail to retrieve more than the end-user friends names and ID... that's all : each end-user Facebook friend is a GraphUser that contains only their name and their ID.
Here is the list of permissions I use :
"user_status", "read_friendlists", "email", "user_location", "friends_location"
Using the Facebook LoginButton, the SDK tells the end-user that the app does require the aforementioned list of permissions.
Bu when I want to use Graphuser.getLocation, I do get null
value.
No city, not state, no ZIP code, no nothing.
This is the code snippet to retrieve the end-user data :
public final void setCurrentUser(final Context context) {
if (this.session != null && this.session.isOpened()) {
final Request requestCurrentUserProfile = Request.newMeRequest(
this.session, new Request.GraphUserCallback() {
public final void onCompleted(final GraphUser user, final Response response) {
currentUser = user; // currentUser is defined as a class member
if (response.getError() != null ) {
// TODO
}
}
});
requestCurrentUserProfile.executeAsync();
} else
this.currentUser = null;
}
Placing a break-point here, with the debugger, the GraphUser representation is complete : I have all the data that I need, including the location !
Regarding the end-user Friends list ...
public final void fetchFriendsList() {
if (this.session != null && this.session.isOpened()) {
final Request requestUserFriendsList = Request.newMyFriendsRequest(
this.session, new Request.GraphUserListCallback() {
public final void onCompleted(final List<GraphUser> users, final Response response) {
if (users != null && users.size() > 0)
userFriendsList = new ArrayList<GraphUser>(users);
}
}
);
requestUserFriendsList.executeAsync();
}
}
This is where the users are almost empty : just a name and an ID. That's it, that's all.
Perhas this Request
doesn't provide more data ?
If so, which method should I use to fetch the data I need ?
Thanks !
[EDIT]
Looking at my app review status I'm not even suppose to rerieve the Friends List nor the location data of the current end-user ?? !
What is happening here ? I don't get it ... please help !
[EDIT2]
To show you the difference between the end-user GraphUser and the end-user friends list GraphUsers, here is a screenshot of the debugger.
Fields have been intentionnaly removed for privacy reasons.