Open jeanluck36 opened 1 year ago
great stuff. This resolved the issue. Please merge this code on the next release. Thanks
@jeanluck36 @sachithd ok, but the build with this plugin still fails receiving this error: android:exported needs to be explicitly specified for element <receiver#nl.xservices.plugins.ShareChooserPendingIntent>. Apps targeting Android 12 and higher are required to specify an explicit value for "android:exported" when the corresponding component has an intent filter defined.
so you have to add android:exported="true"
or better for this plugin false
value, manually on AndroidManifest.xml after adding this plugin...
to you the build works even without this change on android 12?
@jeanluck36 @sachithd I am facing the same issue https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin/issues/1176#issuecomment-1191642022d @dilo99 did you resolve this?
In the plugin.xml file manually added android:exported="true" to receiver element
`
</config-file>`
If you're upgrading to Capacitor 4, you may encounter this issue as I did.
As @sachithd guide above, to save people some time, the file is in node_modules/cordova-plugin-x-socialsharing/plugin.xml
To anyone who got here recently:
I have the same error, and also the error about android:export=true.
The plugin seems dead. Is there any alternative with updates for the latest android?
In the plugin.xml file manually added android:exported="true" to receiver element
<config-file target="AndroidManifest.xml" parent="/*/application"> <receiver android:name="nl.xservices.plugins.ShareChooserPendingIntent" android:enabled="true" android:exported="true"> <intent-filter> <action android:name="android.intent.action.SEND"/> </intent-filter> </receiver> </config-file>
It fix the issue for you? For me, I can't even build. I'm still seeing the message:
Apps targeting Android 12 and higher are required to specify an explicit value for
android:exportedwhen the corresponding component has an intent filter defined. See https://developer.android.com/guide/topics/manifest/activity-element#exported for details
@EddyVerbruggen can you please merge the pr for the solution for Android 12,13 ?
@EddyVerbruggen can you please merge the pr for the solution for Android 12,13 ?
I am also facing the same issue. Is there any solution for the same? Please let me know if it is available.
@Topiya the fix was merged. please remove the plugin and add it again.
Thanks for the reply. but latest plugin install didn't solve the issue for me in "cordova-android": "^11.0.0" I got the solution by using "cordova-plugin-x-socialsharing-android12"
Same case as @Topiya, seems like the latest plugin is still not adding android:exported
to the manifest. I solved it by using the forked plugin cordova-plugin-x-socialsharing-android12
@sachithd @Syahrul @timonjagi @vchabal @Topiya @pedropamn @bonjourjoel @jeanluck36 it has been fixed in my forked repo: https://github.com/EYALIN/community-cordova-plugin-social-sharing
you can install it as an npm package: cordova plugin add community-cordova-plugin-social-sharing --save
Does nl.xservices.plugins.ShareChooserPendingIntent
actually have to be exported or could it be set to false?
I am getting the following for our app by the MobSF static analyzer:
Broadcast Receiver (nl.xservices.plugins.ShareChooserPendingIntent) is not Protected. [android:exported=true]
A Broadcast Receiver is found to be shared with other apps on the device therefore leaving it accessible to any other application on the device.
In Android 12 after trying to use method socialsharing.share(...) the application closes immediately, in android studio shows this error in the log:
To solve this I had to go to android folder in the plugin, find SocialSharing.java, and replace this line:
final PendingIntent pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, PendingIntent.FLAG_UPDATE_CURRENT);
With this code
int pendingIntentValueFLAG = 0; if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.S) { pendingIntentValueFLAG = PendingIntent.FLAG_MUTABLE; } else { pendingIntentValueFLAG = PendingIntent.FLAG_UPDATE_CURRENT; } final PendingIntent pendingIntent = PendingIntent.getBroadcast(cordova.getActivity().getApplicationContext(), 0, receiverIntent, pendingIntentValueFLAG);
Cordova and plugin version: "cordova": "11.0.0" "cordova-android": "^10.1.2" "cordova-plugin-x-socialsharing": "^6.0.3"