Can Corona enable (limited) Facebook sharing on Android via native.showPopup()?

<Nob Studio> and <anil8>: I just checked and Corona-built apps do currently allow text to be selected from a webview then “shared” via Facebook on Android via the system sharing panel. (I placed “shared” in quotes because the selected text doesn’t appear in the Facebook app, but Gmail acts the same way, so presumably FB is being promiscuous in what it accepts.)

But are you aware of Android apps that allow text to be programmatically selected (not via user textfield selection) and shared with Facebook as well? I just want to make sure that we’re not asking Corona to do something impossible, especially because this Facebook policy exists: "Our API does not support pre-filling the message for users” https://developers.facebook.com/bugs/332619626816423/

As an add-on to this. I’m still seeing odd behavior on Android when sharing on some devices/configurations.  

I have a user currently who can see the native share sheet popup in other apps, including Google Play. (I asked for a screenshot to be sure; granted, Google could be doing something custom and just making it look native, but as far as I can tell, it’s the native share sheet.)

However, in my app, when she tries to share a product, she gets an empty list.  

"Share via: No apps can perform this action."  

She just recently updated her Droid Turbo to Lollipop. She has Facebook and Instagram installed. Yet, nothing shows up to share to. I have a Nexus 6 (with Lollipop) for testing, and everything works fine.

local shareImage = {baseDir = system.CachesDirectory, filename = imageFilename} ... local options = {} options.image = { shareImage } options.message = shareText options.url = productWebLink &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; native.showPopup( "social", options )

Nothing too crazy there that I can see.

Has anyone else experienced this?  I’m on Build 2015.2687.

I just tried the social popup in daily build 2015.2647 and when the user clicks on the button he sees:

  • No facebook button
  • Double Twitter button

What do you need to do to show facebook on social popup?

Can you post a screen shot of what’s going on?  Some code on how you’re calling the plugin would be  helpful too.

Rob

Hello Rob,

Thank you for the fast answer, here we go:

build.settings plugins = { ["CoronaProvider.native.popup.social"] = { publisherId = "com.coronalabs" }, }, Game.lua function postFacebook( ) local options = { service = "facebook", message = "I just made "..oScore.." Points in Monsters Fall!", listener = socialEventListener, image = { { filename = "Icon-xhdpi.png", baseDir = system.ResourceDirectory }, }, url = "https://play.google.com/store/apps/details?id=com.loopends.monstersfall" } native.showPopup( "social", options ) end function goFacebook:touch(event) if event.phase == "ended" then postFacebook() end end goFacebook:addEventListener("touch",goFacebook)

Screenshots: (Link to high res: http://postimg.org/gallery/3ikpk0vak/))

Screenshot_2015_06_04_01_13_26.png Screenshot_2015_06_04_01_13_33.png

As you can see im getting double twitter icon, and none facebook.

Thank you very much

Make sure message is blank:

message = “”

Not even a space…

Rob

Hello Rob,

Still getting the same error. Going to try in another device and i tell you soon.

Joe

Actually, try it with just the URL?  On Android we only support URL’s, not images.

Rob

Hello Rob,

That worked, thank you very much.

This means that i can’t share my score on facebook right now, right?

Best Regards

Joe

Joe: See the first message that started this thread last November:

Facebook’s official position is: “Our API does not support pre-filling the message for users” https://developers.facebook.com

I know of no way to pre-fill a Facebook message using the Android social plugin.

We have been waitting several years…and it is a quite basic feature. Is it to difficult to post an image, without text using social sharing on Android?

Hello all. I just ran into this when working with a client and wanted to double check…

Question: Did anyone in the community work out how to fix the ‘double twitter’ icon listing (see images above prior thread entry).

For reference, I’m currently using build 2015.2647 and I still see two Twitter icons listed when I call native.showPopup():

 local options = { service = "facebook", -- ignored on Android message = "some message", } native.showPopup( "social", options ) 

Note: I also tried this with and without a message body and get the same result.

My goal is to list Twitter, Facebook, and all other registered Social sharing apps, but for some reason there are two twitter icons and no Facebook option.  (I think this is an Android bug, and not a Corona issue at all. )

For now, it seems the only reliable way to get Facebook to work on Android (which I want as part of my choice set) is set up a facebook app and use the facebook plugin.

In closing, “if any community member has gotten this to work without going to those lengths, please share your code if you can.”

-Ed

I’m using build 2015.2638 and see Facebook correctly listed once when using Android showPopup sharing. I don’t have Twitter installed on my test device, which is a Nexus 5 with Android 5.1.1. In other words, it works as it should.

@Corona273,

Thanks!  I’ll give that a try!

If it works, I’ll file a bug too.

-Ed

@Corona273,

No joy…  :frowning:

Note: I’m using a Gen 1 Nexus 7 running Android 4.4.4 

I tried uninstalling Twitter just for giggles and that did not help either.  

Thanks again!  I still think this is an Android thing (or it could be my device, I’ll need to test on others.)

Actually I think this is not a bug but a feature.  I just opened the “Photos” app on my 1st Gen Nexus 7 running 5.x and I also got two twitter icons.  However it had text under the icons.  One was “Tweet” the other was “Direct Message”.

Our code allows us to block services, but we have no way of adding them. 

Rob

Hmm… I didn’t notice that.  Thanks for the insight.

I just wish I knew why Facebook is such a stinker.  

The app is installed,

Corona detects it (native.canShowPopup() returns true for “facebook”), 

It just doesn’t show up in the list.   

I usually implement facebook using the plugin, but I’m trying for a lightweight solution as the client doesn’t want to set up a facebook app for their game.

Aside from Facebook not showing up, I really love the social plugin because it lists Instagram, e-mail, and a bunch of other options…

Thank for the answer and time Rob.  

Honestly I’m not sure why canShowPopup() returns true for “facebook” on Android.  The Facebook popup is iOS only.  The “social” popup is a different beast.  It opens an Android share sheet.  We pass in photos, URL’s and text and the share sheet decides what apps to give to you.  We can block things but we can’t add things.

Since Facebook blocks anything with a pre-filled text (and from what I had read – it only supported URLs), when we fixed the plugin to allow URL’s to work, we were still blocking facebook if there were images.  Images are waiting for a code review since they apparently work.

Rob

@Rob,

Thanks man. I was unaware of these additional challenges to using FB via the social plugin.  I’ll try a URL only call and see what I get.  

Regardless, this is all food for thought, and in the future I’ll push clients to simply bite the bullet (small as it is) and make a facebook app, then I can do this the way I know works.  

Thanks again!

-Ed

PS - I’m not a social media user myself (being a bit of a luddite in that area), so I always have trouble getting excited about adding it to a product.  :slight_smile:

Apparently Ed, Facebook does allow images.  The information on what they allow is confusing.  If you are following their developer forum posts, you get plenty of “yes it works” vs. “no it doesn’t”.  So when you get that kinda problem, all you can do is try it yourself.  We went back after the last release that allowed URL’s only to work and tried it passing images in and it does work.  Once those changes clear a code review, we will build a new version of the plugin and you should be able to do both images and URL’s, just not a pre-filled message.

Rob