Difference between revisions of "FBInstant.shareAsync"
(3 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | + | '''Available since:''' Gideros 2018.3<br/> | |
− | ''' | + | '''Class:''' [[* Initialisation and Core]]<br/> |
− | ''' | + | |
− | === | + | === Description === |
− | + | This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. A blob of data can be attached to the share which every game session launched from the share will be able to access from FBInstant.getEntryPointData(). This data must be less than or equal to 1000 characters when stringified. The user may choose to cancel the share action and close the dialog, and the returned promise will resolve when the dialog is closed regardless if the user actually shared the content or not. | |
− | This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. A blob of data can be attached to the share which every game session launched from the share will be able to access from FBInstant.getEntryPointData(). This data must be less than or equal to 1000 characters when stringified. The user may choose to cancel the share action and close the dialog, and the returned promise will resolve when the dialog is closed regardless if the user actually shared the content or not. | + | <syntaxhighlight lang="lua"> |
− | + | FBInstant.shareAsync(payload,callback) | |
− | < | + | </syntaxhighlight> |
− | + | ||
− | </ | + | === Parameters === |
− | === | + | '''payload''': (table) specify what to share<br/> |
− | '''payload''': (table) | + | '''callback''': (function) a function that will be called with two arguments: True when the share is completed or nil if the operation failed, and an error code if the function failed<br/> |
− | '''callback''': (function) | + | |
− | === | + | === Example === |
− | + | <syntaxhighlight lang="lua"> | |
− | < | ||
-- intent can be "INVITE", "REQUEST", "CHALLENGE" or "SHARE" | -- intent can be "INVITE", "REQUEST", "CHALLENGE" or "SHARE" | ||
FBInstant.shareAsync({intent="REQUEST",image=base64Picture,text="X is asking for your help!",data={myReplyData="..."}}, function(result,error) | FBInstant.shareAsync({intent="REQUEST",image=base64Picture,text="X is asking for your help!",data={myReplyData="..."}}, function(result,error) | ||
− | + | if result then | |
-- continue with the game. | -- continue with the game. | ||
end | end | ||
end) | end) | ||
− | < | + | </syntaxhighlight> |
+ | |||
+ | {{FBInstant}} |
Latest revision as of 05:04, 24 June 2024
Available since: Gideros 2018.3
Class: * Initialisation and Core
Description
This invokes a dialog to let the user share specified content, either as a message in Messenger or as a post on the user's timeline. A blob of data can be attached to the share which every game session launched from the share will be able to access from FBInstant.getEntryPointData(). This data must be less than or equal to 1000 characters when stringified. The user may choose to cancel the share action and close the dialog, and the returned promise will resolve when the dialog is closed regardless if the user actually shared the content or not.
FBInstant.shareAsync(payload,callback)
Parameters
payload: (table) specify what to share
callback: (function) a function that will be called with two arguments: True when the share is completed or nil if the operation failed, and an error code if the function failed
Example
-- intent can be "INVITE", "REQUEST", "CHALLENGE" or "SHARE"
FBInstant.shareAsync({intent="REQUEST",image=base64Picture,text="X is asking for your help!",data={myReplyData="..."}}, function(result,error)
if result then
-- continue with the game.
end
end)
- FBInstant.canCreateShortcutAsync
- FBInstant.checkCanPlayerMatchAsync
- FBInstant.createShortcutAsync
- FBInstant.getEntryPointAsync
- FBInstant.getEntryPointData
- FBInstant.getInterstitialAdAsync
- FBInstant.getLeaderboardAsync
- FBInstant.getLocale
- FBInstant.getPlatform
- FBInstant.getRewardedVideoAsync
- FBInstant.getSDKVersion
- FBInstant.getSupportedAPIs
- FBInstant.logEvent
- FBInstant.matchPlayerAsync
- FBInstant.onPause
- FBInstant.quit
- FBInstant.setLoadingProgress
- FBInstant.setSessionData
- FBInstant.shareAsync
- FBInstant.startGameAsync
- FBInstant.switchGameAsync
- FBInstant.updateAsync