Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Facebook Sharing on Android - no URL or Image (or Message) #253

Closed
rajatrocks opened this issue Nov 30, 2014 · 17 comments
Closed

Facebook Sharing on Android - no URL or Image (or Message) #253

rajatrocks opened this issue Nov 30, 2014 · 17 comments

Comments

@rajatrocks
Copy link

On Android 4.4 I've tried sharing to Facebook via .share, .shareViaFacebook, and . shareViaFacebookWithPasteMessageHint - with no image and a url. My url never gets added. Maybe this has something to do with the splitting out of Messenger functionality?

On iOS this works fine.

@EddyVerbruggen
Copy link
Owner

Hi, that URL should be picked up by Android to show a little preview of that webpage. Which URL are you trying to share? Perhaps my code thinks it's malformed...

@rajatrocks
Copy link
Author

You're right! My domain is one of the new TLD's - .fail - so my URL looks like http://www.cannot.fail?id=something. That fails to attach properly to the Facebook post on Android. Using a .com instead works fine. Any chance that can be changed to accept other TLDs? Thanks!

@EddyVerbruggen
Copy link
Owner

Haha, cool domain ;)

Are you able to use the .fail domain in a regular Facebook post? I guess so, because iOS works..

Or is it perhaps a whitelisting issue in your config.xml?

@rajatrocks
Copy link
Author

Yes, I can use it with no problems using Facebook's normal feed dialog (https://developers.facebook.com/docs/sharing/reference/feed-dialog/v2.2) and the iOS version of the social sharing plugin.

My config.xml currently has access origin="*". Is there something else I should look at?

Thanks!

@EddyVerbruggen
Copy link
Owner

Hmm, strange. I just tried this myself and it works on my Samsung Galaxy S3 (Android 4.3). Can you give it a try?

<button onclick="window.plugins.socialsharing.shareViaFacebook('hi', ['http://www.icu.fail/public/style_images/tctc91_simplify/feed.png'], null, function(msg) {alert(msg)}, function(err) {alert(err)})">img via Facebook</button>

@rajatrocks
Copy link
Author

Hi Eddy - sorry if my original post wasn't clear - I'm trying to share a URL, not an image.

.share("Hello there", "Test Subject", null, "http://www.cannot.fail?id=something")

@EddyVerbruggen
Copy link
Owner

Ehm oops you're right - I'll take a look tomorrow!
Knowing the exact url may help me. If it's sensitive feel free to PM me.

@rajatrocks
Copy link
Author

Thanks! Sent it to you in email.

@EddyVerbruggen
Copy link
Owner

Hi, I've tested this URL and every time I try to share it to facebook, the log spits out a stacktrace of the Facebook app. It can't resolve a specific class it seems to need to share this url.

I tried a workaround: use a link shortener, which actually tricks it into sharing the damn thing. It may not produce a nice preview and shows the shortened url, but it does share your original link.

@rajatrocks
Copy link
Author

Thanks @EddyVerbruggen !

@replysam2009
Copy link

replysam2009 commented Feb 12, 2017

@EddyVerbruggen Hi, I am using Social Sharing plugin in one of my Ionic2 projects. Earlier everything was working fine but from past 3 days I am not being able to share anything using different share functions (except for shareViaMail()). Whenever I try to share anything it says: "Attempt to invoke virtual method 'android.content.res.XmlResourceParserandroid.content.pm.ProviderInfo.loadXmlMetaData(android.content.pm.PackageManager, java.lang.String)' on a null object reference."
This happens only when I try to share image. If I share only message and Url, it works fine but if I try to share any image (by giving its url as a string), it throws an error.
Is there anything you can help me with?

@gianpaj
Copy link

gianpaj commented Oct 4, 2017

Do we know why this happens only on Android? Is the Android Facebook or Messenger App doing something after a cordova/ionic sends the correct URL, but not on iOS?
Or can we update some native SDK/code inside this plugin, that could allow for this?

@marceviana
Copy link

I can´t share anything via facebook. The facebook app will crash before opening completely if I use window.plugins.socialsharing.shareViaFacebook


                    window.plugins.socialsharing.shareViaFacebook(null, [fileURL], null, 
                        function successShare(s) {
                            console.log('share ok')
                        }, function errorShare(errormsg){
                            console.log('Error in: shareViaFacebook >> msg:')
                            console.log(errormsg)
                        })

The only function currently working that won't make fb to crash is window.plugins.socialsharing.shareVia('facebook', null, [fileURL]) but then the sharing activity is shown but won't load the file. I've tried both with a local file (file:/...) and a web hosted one, and also video files. All the other apps work as expected (whatsapp, gmail, drive, etc) both with image and video. Any ideas what might be happening?

I'm using version 5.2.1 of the plugin for android:minSdkVersion="14" and android:targetSdkVersion="26"

@mfdeveloper
Copy link

@replysam2009 See my comment #774 (comment) into your issue about loadXmlMetada() error.

@mattkenefick
Copy link

Any updates on this?

I can share an image on Android via Facebook, but the URL doesn't take.

@kierangillen
Copy link

It seems that .edu also doesn't work?

@abdullahMYMA
Copy link

this.socialSharing.shareViaFacebook(text, url).then(data =>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants