2

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)

raito tec
  • 21
  • 3
  • Did this answer help you?https://stackoverflow.com/questions/73502543/app-crashes-targeting-s-version-31-and-above-requires-that-one-of-flag-immu#:~:text=Make%20sure%20you%20are%20on%20the%20latest%20version%20of%20the%20Google%20Analytics%20dependency.%20It%20apparently%20is%20setting%20up%20that%20PendingIntent%2C%20and%20only%20the%20developers%20of%20Google%20Analytics%20can%20change%20that%20behavior – Zack Nov 17 '22 at 08:47

1 Answers1

0

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.

Marcio J
  • 673
  • 7
  • 17