Type function Library native.* Return value none Revision Release 2022.3683 Keywords native, showPopup, social, Twitter, Facebook, Sina Weibo
Displays the operating system's default popup window for a specified service.
Pre-filling messages on Facebook is a violation of their Platform Policy. On iOS 8.0+ and Android, options.message
is not supported and Facebook will silently ignore this field if you try to use it.
native.showPopup( name, options )
String. The string name of the popup to be shown. For the Social Popup plugin, use "social"
.
Table. A table that specifies the optional properties for the popup — see the next section for details.
String. Required for iOS only, indicating the name of the social service popup to show. Supported values are "twitter"
, "facebook"
, or "sinaWeibo"
. This key is ignored on Android.
Table. Table containing { baseDir=, filename= }
of the images you wish to post.
String. String that pre-populates the message field of the popup. On iOS 8.0+ and Android, this is not supported with Facebook as it violates thier platform policy. Facebook will silently ignore this field if you try to use it on iOS 8.0+ and Android.
Listener. Listener function which supports popup events.
local serviceName = "twitter" -- Supported values are "twitter", "facebook", or "sinaWeibo" local isAvailable = native.canShowPopup( "social", serviceName ) if ( isAvailable ) then local listener = {} function listener:popup( event ) print( "name: " .. event.name ) print( "type: " .. event.type ) print( "action: " .. tostring( event.action ) ) print( "limitReached: " .. tostring( event.limitReached ) ) end native.showPopup( "social", { service = serviceName, message = "Hi there!", listener = listener, image = { { filename="world.jpg", baseDir=system.ResourceDirectory }, { filename="bkg_wood.png", baseDir=system.ResourceDirectory } }, url = { "http://www.coronalabs.com", "http://docs.coronalabs.com" } }) else native.showAlert( "Cannot send " .. serviceName .. " message.", "Please setup your " .. serviceName .. " account or check your network connection.", { "OK" } ) end
© 2020-2023 Solar2D All Rights Reserved.
Help us help you! If you notice a problem with this page, please report it.