Facebook AppRequest handle on unity3d game

北城余情 提交于 2019-12-04 14:10:43

You have two options:

  • when an app request is created you always get a unique id back, which you can use to tie back to what type it is via a data tracking system (e.g. Parse)
  • when you call FB.AppRequest you can pass in a string as the 'data' parameter which will subsequently be returned to you when you fetch a user's app requests. (e.g. FB.API("/me/apprequests", YourCb);)

One other thing to pay attention to is if a player comes to your game via an app request, which you may want to respond to or notify them of. For example on Canvas: - Bobby McGee visits https://apps.facebook.com/friendsmashunity, sends me a request via FB.AppRequest. the return value of that call will be something like:

{ "request": "467375710036144", "to": [ "my_user_id" ] }

Then I see a notification like this:

When I click on this link it opens up your game with the following parameters (you can see request_ids is one of them) - https://apps.facebook.com/friendsmashunity/?fb_source=notification&request_ids=467375710036144&ref=notif&app_request_type=user_to_user&notif_t=app_request

You can get the 'data' from an appid by calling FB.API:

  • call FB.AppRequest(...,data="life") => request id = 1234
  • later, a player visits your game with the request id 1234
  • you call FB.API("/1234") : the resulting JSON string will have a field data="life"

Hope this helps, and thanks for trying the SDK!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!