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)
1条答案
按热度按时间tjrkku2a1#
检查您的通知插件包是否有新版本,如果有,请更新您的应用。在我的情况下,我使用的是a plugin,很长一段时间没有更新,当我将Android 12作为目标时,我的应用开始崩溃。所以我改用newer plugin。