Search code examples
androidfacebookfacebook-friends

Differentiate two friends with the same name from friend's list (Facebook Android)


I am currently working on a project using the Facebook SDK on Android. I managed to get a user's friend's list with first and last name, id, and profile picture and would like to save their profile picture on the external sd-card to support offline uses of my app.

To do so, I need a unique name for each user's friend, that stay constant between different sessions in order to load the local picture with the appropriate user. I tried using the field "id", but the values are change each time I refresh the Facebook token. Therefore, I am not able to recover my picture when reloading the app. If I use first name and last name, and a user have two friends with the first and last name identical, I will have some issues to differentiate them (ex: Jon_Snow.jpg & Jon_Snow.jpg)

How can I get a unique user identification for each friends that stay the same even after refreshing the token?

Thanks for your help.


Solution

  • The edge /me/invitable_friends does not return IDs for the friends, it returns tokens that are re-generated on each request and are only meant to be used to invite friends to the app using the designated APIs.

    To sum it up, what you are trying to do with this endpoint is not possible, also using /me/friends is not possible as it will only return a list of friends that already use your app.

    Also, just on a side note, the edge is reserved for Games and not for use by non-game apps.