Difference between revisions of "FBInstant.updateAsync"
From GiderosMobile
(Created page with "__NOTOC__ '''Available since:''' Gideros 2018.3<br/> === Description === <br /> Informs Facebook of an update that occurred in the game. This will temporarily yield control to...") |
|||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
'''Available since:''' Gideros 2018.3<br/> | '''Available since:''' Gideros 2018.3<br/> | ||
+ | '''Class:''' [[* Initialisation and Core]]<br/> | ||
+ | |||
=== Description === | === Description === | ||
− | + | Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. The returned promise will resolve/reject when Facebook returns control to the game. | |
− | Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. The returned promise will resolve/reject when Facebook returns control to the game. | + | <syntaxhighlight lang="lua"> |
− | + | FBInstant.updateAsync(payload,callback) | |
− | < | + | </syntaxhighlight> |
− | + | ||
− | </ | + | === Parameters === |
− | '''payload | + | '''payload''': (table) a payload that describes the update<br/> |
− | '''callback | + | '''callback''': (function) a function that will be called with two arguments: True when Facebook gives control back to the game or nil if the operation failed, and an error code if the function failed<br/> |
+ | |||
+ | === Example === | ||
+ | <syntaxhighlight lang="lua"> | ||
+ | -- This will post a custom update. If the game is played in a messenger | ||
+ | -- chat thread, this will post a message into the thread with the specified | ||
+ | -- image and text message. And when people launch the game from this | ||
+ | -- message, those game sessions will be able to access the specified blob | ||
+ | -- of data through FBInstant.getEntryPointData(). | ||
+ | FBInstant.supdateAsync({action="CUSTOM", | ||
+ | cta="Join The Fight", | ||
+ | image=base64Picture, | ||
+ | test={default="X just invased Y\'s village!", | ||
+ | localizations={ ar_AR="X \u0641\u0642\u0637 \u063A\u0632\u062A \u0642\u0631\u064A\u0629 Y!", | ||
+ | en_US="X just invaded Y\'s village!", | ||
+ | el_LA="\u00A1X acaba de invadir el pueblo de Y!"} | ||
+ | }, | ||
+ | template="VILLAGE_INVASION", | ||
+ | data={myReplayData="..."+, | ||
+ | strategy="IMMEDIATE", | ||
+ | notification="NO_PUSH"}, function(result,error) | ||
+ | if result then | ||
+ | -- closes the game after the update is posted. | ||
+ | FBInstant.quit() | ||
+ | end | ||
+ | end) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | {{FBInstant}} |
Latest revision as of 04:51, 24 June 2024
Available since: Gideros 2018.3
Class: * Initialisation and Core
Description
Informs Facebook of an update that occurred in the game. This will temporarily yield control to Facebook and Facebook will decide what to do based on what the update is. The returned promise will resolve/reject when Facebook returns control to the game.
FBInstant.updateAsync(payload,callback)
Parameters
payload: (table) a payload that describes the update
callback: (function) a function that will be called with two arguments: True when Facebook gives control back to the game or nil if the operation failed, and an error code if the function failed
Example
-- This will post a custom update. If the game is played in a messenger
-- chat thread, this will post a message into the thread with the specified
-- image and text message. And when people launch the game from this
-- message, those game sessions will be able to access the specified blob
-- of data through FBInstant.getEntryPointData().
FBInstant.supdateAsync({action="CUSTOM",
cta="Join The Fight",
image=base64Picture,
test={default="X just invased Y\'s village!",
localizations={ ar_AR="X \u0641\u0642\u0637 \u063A\u0632\u062A \u0642\u0631\u064A\u0629 Y!",
en_US="X just invaded Y\'s village!",
el_LA="\u00A1X acaba de invadir el pueblo de Y!"}
},
template="VILLAGE_INVASION",
data={myReplayData="..."+,
strategy="IMMEDIATE",
notification="NO_PUSH"}, function(result,error)
if result then
-- closes the game after the update is posted.
FBInstant.quit()
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