Difference between revisions of "FBInstant.shareAsync"

From GiderosMobile
m (Text replacement - "</source>" to "</syntaxhighlight>")
 
(2 intermediate revisions by 2 users not shown)
Line 7: Line 7:
 
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.<br />
 
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.<br />
 
<br /></translate>
 
<br /></translate>
<source lang="lua">
+
<syntaxhighlight lang="lua">
 
  FBInstant.shareAsync(payload,callback)
 
  FBInstant.shareAsync(payload,callback)
</source>
+
</syntaxhighlight>
 
=== <translate>Parameters</translate> ===
 
=== <translate>Parameters</translate> ===
 
'''payload''': (table) <translate>Specify what to share.</translate> <br/>
 
'''payload''': (table) <translate>Specify what to share.</translate> <br/>
Line 15: Line 15:
 
=== <translate>Examples</translate> ===
 
=== <translate>Examples</translate> ===
 
'''Example'''<br/>
 
'''Example'''<br/>
<source lang="lua">
+
<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)
Line 22: Line 22:
 
end
 
end
 
end)
 
end)
<br/></source>
+
<br/></syntaxhighlight>
 +
 
 +
{{FBInstant}}

Latest revision as of 15:29, 13 July 2023


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.

Examples

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)
<br/>