Skip to content

Instantly share code, notes, and snippets.

@coronarob
Last active August 29, 2015 14:17
Show Gist options
  • Save coronarob/a2ae8a6a87e192fe018b to your computer and use it in GitHub Desktop.
Save coronarob/a2ae8a6a87e192fe018b to your computer and use it in GitHub Desktop.
Function to show the activity popup.
local shareButton -- will define later
local function showShare()
local popupName = "activity"
local isAvailable = native.canShowPopup( popupName )
local isSimulator = "simulator" == system.getInfo( "environment" )
-- If it is possible to show the popup
if isAvailable then
local listener = {}
function listener:popup( event )
print( "name(" .. event.name .. ") type(" .. event.type .. ") activity(" .. tostring(event.activity) .. ") action(" .. tostring(event.action) .. ")" )
end
-- Show the popup
native.showPopup( popupName,
{
items = items,
-- excludedActivities = { "UIActivityTypeCopyToPasteboard", },
listener = listener,
origin = shareButton.contentBounds,
permittedArrowDirections={ "up", "down" }
})
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( "Error", "Can't display the view controller. Are you running iOS 7 or later?", { "OK" } )
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment