I'm working to support android 14 in a certain app, i'm having one issue with android native share sheet, since we have a pending intent with FLAG_MUTABLE, i'm getting this error
2023-10-16 14:23:20.368 10001-10001 com.package.x.android.shopping E java.lang.RuntimeException: Unable to start activity ComponentInfo{com.package.x.android.shop/com.package.x.NativeShareActivity}: java.lang.IllegalArgumentException: com.package.x.android.shop: Targeting U+ (version 34 and above) disallows creating or retrieving a PendingIntent with FLAG_MUTABLE, an implicit Intent within and without FLAG_NO_CREATE and FLAG_ALLOW_UNSAFE_IMPLICIT_INTENT for security reasons. To retrieve an already existing PendingIntent, use FLAG_NO_CREATE, however, to create a new PendingIntent with an implicit Intent use FLAG_IMMUTABLE.
Based on android 14 documentation, it's not possible anymore to use flag_mutable pendingIntent for security reasons, and changing the pending intent to FLAG_IMMUTABLE will prevent us from getting the shared channel choosed by customer, is there a way to use flag*_immutable and still be able to get the share channel choosed by customer.
I have tried to change the intent type to explicit, however i'm not sure what should be the component name in this case.
Thanks.
The component name is given in the error message:
To make the
Intent
explicit, you should only need to set the package name tocom.package.x.android.shop
.