I only changed some red code from source code.
https://github.com/coronalabs/plugins-sample-native-popup-social/
local function onShareButtonReleased( event ) local serviceName = event.target.id local isAvailable = native.canShowPopup( popupName, serviceName ) -- For demonstration purposes, we set isAvailable to true here for Android. if "Android" == system.getInfo( "platformName" ) then isAvailable = true end -- If it is possible to show the popup if isAvailable then local listener = {} function listener:popup( event ) print( "name(" .. event.name .. ") type(" .. event.type .. ") action(" .. tostring(event.action) .. ") limitReached(" .. tostring(event.limitReached) .. ")" ) end local options = {} options.service = serviceName options.listener = listener if sendMessage then options.message = "I saved the planet using Corona SDK" end if sendURL then options.url = { "http://www.coronalabs.com" } end if sendImage then options.image = { { filename = "share.jpg", baseDir = system.ResourceDirectory }, } end -- Show the popup native.showPopup( popupName, options ) else if isSimulator then native.showAlert( "Build for device", "This plugin is not supported on the Corona Simulator, please build for an iOS/Android device or the Xcode simulator", { "OK" } ) else -- Popup isn't available.. Show error message native.showAlert( "Cannot send " .. serviceName .. " message.", "Please setup your " .. serviceName .. " account or check your network connection (on android this means that the package/app (ie Twitter) is not installed on the device)", { "OK" } ) end end end local function onSwitchPress( event ) local switch = event.target print( "Switch with ID '"..switch.id.."' is on: "..tostring(switch.isOn) ) if switch.id == "message" then sendMessage = switch.isOn elseif switch.id == "url" then sendURL = switch.isOn elseif switch.id == "image" then sendImage = switch.isOn display.save( background,"share.jpg", system.DocumentsDirectory ) end end