distriqt / airnativeextensions

DEPRECATED: Original repository of the distriqt native extensions and is no longer maintained. Please see our site for the latest ANEs
https://airnativeextensions.com
2 stars 0 forks source link

Clarification for FacebookAppRequestParams #262

Closed minimedj closed 9 years ago

minimedj commented 9 years ago

Hi guys,

To invite friends to my game I use the following code:

var params:FacebookAppRequestParams = new FacebookAppRequestParams();
params.app_id = "FB_APP_ID";
params.data = "my_payload";
params.redirect_url = "APP_STORE_URL";
FacebookAPI.service.openRequestsDialog(params, requestDialogResultHandler);

How I can retrieve params.data = "my_payload"; when invitation is being accepted?

minimedj commented 9 years ago

For those who might be interested you do it this way:

https://graph.facebook.com/me/apprequests?fields=id,application,to,from,data,message,action_type,object,created_time&access_token=ACCESS_TOKEN

You will het nice JSON that shows you all requests with data field attached.

koriner commented 9 years ago

There are also helper methods built in to the ANE which help with loading app request data.

When your app starts up from someone accepting a request, a FacebookAppRequestEvent.APP_REQUESTS_FOUND event will be dispatched.

If you get this event, you can use the FacebookAPI.service.loadAppRequestInfo() method to load data about them.

This stuff is covered in the documentation as well:

http://docs.airnativeextensions.com/facebookapi/docs/com/distriqt/extension/facebookapi/FacebookAPI.html#loadAppRequestInfo()

http://docs.airnativeextensions.com/facebookapi/docs/com/distriqt/extension/facebookapi/events/FacebookAppRequestEvent.html

Your method should work anyway as these helper functions are just wrappers for the graph API.