Notbad
Notbad

Reputation: 6296

Managing facebook invites with new API 2.0 on android

I have seen some android apps around that are able to invite friends to the app and detect when these friends have accepted the request.

I have been reading a bunch of documentation there at facebook and I can see I just need to create a request dialog to let the current signed user invite people. The problem comes when I want to know if this invited people have accepted the invitation and have installed the app.

First of all, It seems that I can just use the invite api if I have a canvas application beside the android one (At least this is what the docs state when using new 2.0 api -> "The invitable_friends API is only available for games that have a Facebook Canvas app implementation using version 2.0 of the Graph API."). Does this need to be in production too? Or I can just leave the canvas application as a placeholder there at facebook developer portal and just use the android one.

Second, How am I supposed to query the information I need (check if the friend the user invited has accepted + installed my app)?

Upvotes: 0

Views: 334

Answers (1)

Gaston Claret
Gaston Claret

Reputation: 998

The solution is a bit more complex that what it seems. Here is an approach you can take to get this working:

  1. From inside your game, you can invite non-player friends by querying the Invitable Friends graph api call newly introduced in 2.0, and then creating a multi friend selector to invite those friends.
  2. Suppose a player accepts that request, and enters your game. Their URL will contain extra information (won't be just app.facebook.com/yourgame), so you have to use Deep Linking to parse that extra information, and know that the user came because YOU invited him (you can send data in the request to help you do this). After you do this, a server is needed with a backend to record that your friend accepted your request and is playing.
  3. Now, in the sender account, you need to query the server to see if any friend of yours accepted, and then give the appropriate message/reward.

Hope this clears up how to achieve this!

Upvotes: 1

Related Questions