Ive seen this issue a few times now, but never for xamarin.forms:
When I am trying to deploy on android 12 I am getting:
com.interiorcircle.interiorcircledroid: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, eg if it needs to be used with inline replies or bubbles.
Appearently, a flag needs to be set, but I cannot figure out where.
Anyone has some help here?
Install the Xamarin.AndroidX.work.runtime to remove error. See link below.
See the following https://stackoverflow.com/a/70157415/6902149
In my case following code has fixed the runtime error:
var pendingIntentFlags = (Build.VERSION.SdkInt >= BuildVersionCodes.S)
? PendingIntentFlags.UpdateCurrent | PendingIntentFlags.Mutable
: PendingIntentFlags.UpdateCurrent;
var pendingActivityIntent = PendingIntent.GetActivity(Application.Context, requestCode, activityIntent, pendingIntentFlags);
var pendingIntent = PendingIntent.GetBroadcast(Application.Context, requestCode, intent, pendingIntentFlags);
If you cannot figure out where then you probably don't use PendingIntent
in your code.
In that case it means that some of the packages that you use is using this code and they need to fix it. Possibly you need to report the problem to them if they are not already aware of it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.