Cordova sharing plugin does not share message on facebook

Issue

I’m using the cordova share plugin to share something on my facebook profile. I need to share a link, with a message and an image. But for now I am willing to share a message and I can never do it. Nothing appears. This works for me for twitter and whatsapp but not for facebook. why?

var text="any text";
var image_gif="" //image gif of my cellphone 
var link="https://play.google.com/store/apps/details?id=com.facebook.katana"
 $cordovaSocialSharing.shareViaFacebook(text, image_gif,link).then(function(result) {
    // Success!
    }, function(err) {
    alert("problem")
 });

I am using android device

Solution

This is a limitation of the plugin. Read plugins documentation.

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.

Answered By – Swapnil Patwa

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published