EddyVerbruggen / SocialSharing-PhoneGap-Plugin

👨‍❤️‍💋‍👨 Cordova plugin to share text, a file (image/PDF/..), or a URL (or all three) via the native sharing widget
MIT License
1.78k stars 908 forks source link

WorkAround for Sharing both Image and Url on Facebook #520

Open jnccneto opened 8 years ago

jnccneto commented 8 years ago

hi

I am using cordova-plugin-x-socialsharing 5.0.10

and trying to have a Image and Url posted on the user wall, but the plugin only takes img or url, not both. Just notice on docs that it is supposed to work like that Any ideas on how to overcome this? Cheers Jose

EduardoNE commented 8 years ago

look this: https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/blob/master/README.md

Facebook Android: sharing a message is not possible. You can share either a link or an image (not both), but a description can not be prefilled. See this Facebook issue which they won't solve. As an alternative you can use shareViaFacebookWithPasteMessageHint since plugin version 4.3.4. See below for details. Also note that sharing a URL on a non standard domain (like .fail) may not work on Android. Make sure you test this. You can use a link shortener to workaround this issue.

Facebook iOS: message, image (other filetypes are not supported), link. Beware that since a Fb update in April 2015 sharing a prefilled message is no longer possible when the Fb app is installed (like Android), see #344. Alternative: use shareViaFacebookWithPasteMessageHint.

EduardoNE commented 8 years ago

you can concatenate your link with the text

ashiqsulaiman commented 6 years ago

@EduardoNE That will not work. Facebook still recognises the URL and hides the image.

marceviana commented 6 years ago

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"