Search code examples
facebookapimobile-application

How to find out which of your facebook friends are also using your mobile app?


We are building mobile app that uses Facebook for registration (know how to do this). We would like to have a screen, where all your friends would be listed with indication, if they also use our app.

How should we save data (client, server) that one facebook user is also our app user?


Solution

  • When you're already using Facebook for authentication, you probably already have a column in the user table in your database that holds Facebook profile ids of each user. If you want to distinguish between them, just add a column modeling if that user is also using your mobile app.

    By issuing a request to https://graph.facebook.com/PROFILE_ID/friends as described in the Facebook Graph API Documentation you can get the list of friends for a certain user without requiring any additional permissions.

    Now just build the intersection between the friends list of the user and your (mobile app) user base and you got the list of his friends that are using your mobile app. You should of course do this comparision on the server, so you don't have to send the Facebook ids of your complete user base around.