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 905 forks source link

Facebook sharing error on Android SDK version 20 #1171

Open viking2917 opened 2 years ago

viking2917 commented 2 years ago

(similar to, but I think different from, https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/1095, the error messages are different and the error occurs after using 6.0.3 which has the fix for 1095, and taking steps as outlined in that issue).

In an Ionic 1 application, with version 6.0.3 of this plugin installed, and in config.xml:

<preference name="android-targetSdkVersion" value="30" />

Facebook sharing errors on Android SDK version 30, with the call:

window.plugins.socialsharing.shareViaFacebookWithPasteMessageHint("test message", [], "https://www.google.com", null, onSuccess, onError);

var onError = function (msg) {
     console.log("Sharing failed with message: " + msg);
};

The onError function gets called with the error message:

msg (3) ['com.android.bluetooth', 'com.google.android.gms', 'com.ionicframework.bookship']

The error occurs with any message or url, and whether the images argument is passed as null or [].

Changing the target SDK version to 29 instead of 30 allows the call to work, however, Google Play no longer accepts applications using version 29!