Can't share images with the Social Popup on Android

I’m trying to add a Share Screenshot button to my game, however, I can’t get the social popup to work. When the button is pressed, I save an image via display.save, then wait 100ms and bring up the social popup. But when I click an option from the popup (such as email, text, dropbox, etc) nothing happens. The popup just goes away. I don’t see any error messages in logcat or anything.

Here is my code

local stage = display.currentStage display.save( stage, "image.png", system.DocumentsDirectory ) timer.performWithDelay(100, function() 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", { listener = listener, image = { { filename="image.png", baseDir=system.DocumentsDirectory }, }, }) end)

I also tried sharing an image that was bundled in the resource directory, and still nothing happens. If I set a message instead of an image, it does appear to work.

This popup seems to work fine in another Corona made app called Bubble Toad, so I know that it is possible.

Thanks

bump

What version of Corona are you using?

What Device/Operating System are you testing on?

Rob

Hi Rob,

I’m on Corona Version 2017.3068. My phone is a Galaxy S6 running Android 7.0.

Thanks

@Vince_, you cannot add a local image to share. This is a big no go. You can only share images that are already on the net with Facebook. If you want to share a local image, you will need first to upload it to your server or other image server you may have access, and then use the proper URL to feed to Facebook.

@nmichaud, Thanks for the heads up. Is there documentation anywhere that says that? Regardless, I’m not only trying to share on FB. Nothing happens when I choose, email, text, Twitter, Dropbox, Hangouts…etc.

Yup its mention on the FB feed dialog section of their SDK.

You can easily set the name, description, image URL and the source URL. But depending of which parameter you use, some other parameters will be ignored. 

PS: I never use native.showpopup with the “social” request. I always use the FB plugin in my app for better integration and possibilities.

Edit: Its seems I was wrong and we can post a local image with the social plugin. Sorry for the confusion here.

@nmichaud, the other Corona game that I mention in my original post appears to be using the social popup to post an image to Facebook.

Either way, my issue still persists where I can’t share my image at all through any other platform.

The social popup should allow you to share a local image. Can you produce a sample/demo app complete with main.lua, config.lua and build.settings and any assets to demo the problem and share it on DropBox or GoogleDrive with us?

Thanks

Rob

@Rob,

I went ahead and made a barebones app to test the functionality and lo and behold it worked. So I made sure that the code was the same in my main app, and it was but still nothing would happen.

I wound up taking a look at my build.settings and found this little bugger which seemed to be preventing other apps from accessing the app’s sandbox

--REMOVE THIS IF YOU WANT TO SHARE IMAGES USING THE SOCIAL POPUP ON ANDROID allowAppsReadOnlyAccessToFiles = false,

Not sure why I added that in the first place but I have removed it and sharing works perfectly now. I can even post the image to my timeline on Facebook.

Thanks

bump

What version of Corona are you using?

What Device/Operating System are you testing on?

Rob

Hi Rob,

I’m on Corona Version 2017.3068. My phone is a Galaxy S6 running Android 7.0.

Thanks

@Vince_, you cannot add a local image to share. This is a big no go. You can only share images that are already on the net with Facebook. If you want to share a local image, you will need first to upload it to your server or other image server you may have access, and then use the proper URL to feed to Facebook.

@nmichaud, Thanks for the heads up. Is there documentation anywhere that says that? Regardless, I’m not only trying to share on FB. Nothing happens when I choose, email, text, Twitter, Dropbox, Hangouts…etc.

Yup its mention on the FB feed dialog section of their SDK.

You can easily set the name, description, image URL and the source URL. But depending of which parameter you use, some other parameters will be ignored. 

PS: I never use native.showpopup with the “social” request. I always use the FB plugin in my app for better integration and possibilities.

Edit: Its seems I was wrong and we can post a local image with the social plugin. Sorry for the confusion here.

@nmichaud, the other Corona game that I mention in my original post appears to be using the social popup to post an image to Facebook.

Either way, my issue still persists where I can’t share my image at all through any other platform.

The social popup should allow you to share a local image. Can you produce a sample/demo app complete with main.lua, config.lua and build.settings and any assets to demo the problem and share it on DropBox or GoogleDrive with us?

Thanks

Rob

@Rob,

I went ahead and made a barebones app to test the functionality and lo and behold it worked. So I made sure that the code was the same in my main app, and it was but still nothing would happen.

I wound up taking a look at my build.settings and found this little bugger which seemed to be preventing other apps from accessing the app’s sandbox

--REMOVE THIS IF YOU WANT TO SHARE IMAGES USING THE SOCIAL POPUP ON ANDROID allowAppsReadOnlyAccessToFiles = false,

Not sure why I added that in the first place but I have removed it and sharing works perfectly now. I can even post the image to my timeline on Facebook.

Thanks

Hi @Vince2 , I want to develop the same function in the Android version but cannot realize it. Can you provide your sample code?

Best Regard
Vincent