[Social Sharing Plugin] Permission for Android SDK 30
social-sharing-plugin
Mobile icon
Forge component by Experts
Application Type
Mobile

Hello,

First of all, thank you for making this plugin available to the community.

Since the plugin's ShareViaEmail client action does not allow adding attachments, we copied it to a new module and added that functionality (which is available in the cordova plugin itself). This worked well for Android 9 & 10 but, for Android 11 (SDK 30), the files provided as input are not attached to the email. To try and solve this issue, we searched GitHub and successfully applied the change proposed on this post:

  • <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />

I am not totally sure why this works and, according to this article, the app will most probably not be eligible for submission on the Play Store.

Do you know an alternative solution which would allow attachments to be included in the call to the window.plugins.socialsharing.shareViaEmail() function?

Thank you,

Rui

Hi,

I believe we found the correct solution for this issue. We added the 2 lines in blue below to the plugin.xml file and kept everything else untouched:

<config-file target="AndroidManifest.xml" parent="/manifest/queries">
	 <package android:name="com.instagram.android" />
	 <package android:name="com.facebook.katana" />
	 <package android:name="com.twitter.android" />
	 <package android:name="com.whatsapp" />
	 <package android:name="com.google.android.gm" />
	 <package android:name="com.microsoft.office.outlook" />
</config-file>

It would be great if you could add this change to your GitHub repository! Otherwise, we will have to keep a clone of the Social Sharing Plugin in our factory just to accommodate this fix...

Thank you,

Rui

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.