native.showPopup() — Social Popup

Type function
Library native.*
Return value none
Revision Release 2024.3703
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 )
name (required)

String. The string name of the popup to be shown. For the Social Popup plugin, use "social".

options (optional)

Table. A table that specifies the optional properties for the popup — see the next section for details.

Options Reference

service (optional)

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.

image (optional)

Table. Table containing sub-tables in the form { baseDir=, filename= } of the images you wish to post.

message (optional)

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 (optional)

Listener. Listener function which supports popup events.

url (optional)

String or Array. Single string or an array of strings. Each string is a URL to post.


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: " .. )
        print( "type: " .. event.type )
        print( "action: " .. tostring( event.action ) )
        print( "limitReached: " .. tostring( event.limitReached ) )

    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 = 


        "Cannot send " .. serviceName .. " message.",
        "Please setup your " .. serviceName .. " account or check your network connection.",
        { "OK" } )