Reputation: 21
I use firebase to push notifications in Xamarin forms, works fine when application open but when test in background I got exaptation
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, e.g. if it needs to be used with inline replies or bubbles.
I Searched for this error and find ,should install Xamarin.AndroidX.Work.Runtime Nuget package, install Xamarin.AndroidX.Work.Work.Runtime.Ktx Nuget package and install Xamarin.Firebase.Analytics , I installed them but not work the same exception still appear. how can I fix this exaptation?
this log data
[AndroidRuntime] FATAL EXCEPTION: Firebase-PNFirebaseMessagingService [AndroidRuntime] Process: com.raitotec.manaawateer, PID: 2365 [AndroidRuntime] java.lang.IllegalArgumentException: com.raitotec.manaawateer: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent. [AndroidRuntime] Strongly consider using FLAG_IMMUTABLE, only use FLAG_MUTABLE if some functionality depends on the PendingIntent being mutable, e.g. if it needs to be used with inline replies or bubbles. [AndroidRuntime] at android.app.PendingIntent.checkFlags(PendingIntent.java:378) [AndroidRuntime] at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461) [AndroidRuntime] at android.app.PendingIntent.getActivity(PendingIntent.java:447) [AndroidRuntime] at android.app.PendingIntent.getActivity(PendingIntent.java:411) [AndroidRuntime] at com.google.firebase.messaging.zza.zzh(Unknown Source:124) [AndroidRuntime] at com.google.firebase.messaging.FirebaseMessagingService.zzd(Unknown Source:57) [AndroidRuntime] at com.google.firebase.iid.zzc.run(Unknown Source:2) [AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) [AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) [AndroidRuntime] at com.google.android.gms.common.util.concurrent.zza.run(Unknown Source:6) [AndroidRuntime] at java.lang.Thread.run(Thread.java:1012)
Upvotes: 2
Views: 594
Reputation: 780
Check if there is a new version of your notification plugin package and if so, update your app. In my case, I was using a plugin that has not been updated for a long time and started crashing my app when I targeted Android 12. So I changed to a newer plugin.
Upvotes: 0