Hi,
Is it possible to share scores on android with : SMS, whatsapp, twiter…etc ? If so, how ?
this the last thing I need to add and I’m struggling to find a way to do it.
Hi,
Is it possible to share scores on android with : SMS, whatsapp, twiter…etc ? If so, how ?
this the last thing I need to add and I’m struggling to find a way to do it.
You can do this with our “social” plugin, which allows you to display a popup dialog via Android’s native share intent. Have a look at our blog post on how to do so here…
https://coronalabs.com/blog/2015/04/21/tutorial-social-sharing-on-android
Hi Joshua. thanks for the reply. I tried to implement it and I get this error:
Attempt to index local ‘event’ (a nil value)
File: menu.lua
Line: 173
here’s the code:
local function onShareButtonReleased( event ) local serviceName = event.target.id local isAvailable = native.canShowPopup( "social", serviceName ) -- 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 -- Show the popup native.showPopup( "social", { service = serviceName, -- The service key is ignored on Android. message = "OMG. I reached to level"..\_G.ta,glevel.."on #Catch\_Circles. Download it if u can beat me", listener = listener, image = { { filename = "Icon.png", baseDir = system.ResourceDirectory }, }, url = { "http://play.google.com", } }) else if isSimulator then native.showAlert( "Build for device", " 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", { "OK" } ) end end end function sharebtn:touch(e) if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased() else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
The issue is caused by your call to the onSharebuttonReleased() function. That function expects an event table argument.
Line 1 and Line 2 Change to this
local function onShareButtonReleased( myType ) local serviceName = myType
Update this:
function sharebtn:touch(e) if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased() else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
To this:
function sharebtn:touch(e) local socialType = "twitter"-- Supported values are "twitter", "facebook", or "sinaWeibo" if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased(socialType) else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
Hi @scottrules44.
Thanks. your solution worked. But, will it only share on twitter ?
I want to show all the options 
On android this should work.
You need to use this(https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_activity/index.html#TOC) for iOS. Check out this blog post for more details. https://coronalabs.com/blog/2015/03/17/tutorial-utilizing-the-activity-popup-plugin-ios/
Facebook doesn’t allow images to be uploaded like this anymore, except for maybe on older iOS versions. That’s why Facebook won’t show up as an option in social popup (aka: Android’s native share intent). This is a restriction imposed on Facebook’s end. Instead, Facebook only allows you to post links to images or upload images via the Facebook SDK using Corona’s Facebook plugin.
You can do this with our “social” plugin, which allows you to display a popup dialog via Android’s native share intent. Have a look at our blog post on how to do so here…
https://coronalabs.com/blog/2015/04/21/tutorial-social-sharing-on-android
Hi Joshua. thanks for the reply. I tried to implement it and I get this error:
Attempt to index local ‘event’ (a nil value)
File: menu.lua
Line: 173
here’s the code:
local function onShareButtonReleased( event ) local serviceName = event.target.id local isAvailable = native.canShowPopup( "social", serviceName ) -- 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 -- Show the popup native.showPopup( "social", { service = serviceName, -- The service key is ignored on Android. message = "OMG. I reached to level"..\_G.ta,glevel.."on #Catch\_Circles. Download it if u can beat me", listener = listener, image = { { filename = "Icon.png", baseDir = system.ResourceDirectory }, }, url = { "http://play.google.com", } }) else if isSimulator then native.showAlert( "Build for device", " 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", { "OK" } ) end end end function sharebtn:touch(e) if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased() else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
The issue is caused by your call to the onSharebuttonReleased() function. That function expects an event table argument.
Line 1 and Line 2 Change to this
local function onShareButtonReleased( myType ) local serviceName = myType
Update this:
function sharebtn:touch(e) if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased() else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
To this:
function sharebtn:touch(e) local socialType = "twitter"-- Supported values are "twitter", "facebook", or "sinaWeibo" if e.phase == "began" then transition.to( sharebtn, { time = 100, xScale = 1.2, yScale = 1.2} ) onShareButtonReleased(socialType) else transition.to( sharebtn, { time = 100, xScale = 1, yScale = 1} ) end end sharebtn:addEventListener( "touch", sharebtn )
Hi @scottrules44.
Thanks. your solution worked. But, will it only share on twitter ?
I want to show all the options 
On android this should work.
You need to use this(https://docs.coronalabs.com/plugin/CoronaProvider_native_popup_activity/index.html#TOC) for iOS. Check out this blog post for more details. https://coronalabs.com/blog/2015/03/17/tutorial-utilizing-the-activity-popup-plugin-ios/
Facebook doesn’t allow images to be uploaded like this anymore, except for maybe on older iOS versions. That’s why Facebook won’t show up as an option in social popup (aka: Android’s native share intent). This is a restriction imposed on Facebook’s end. Instead, Facebook only allows you to post links to images or upload images via the Facebook SDK using Corona’s Facebook plugin.