【发布时间】:2022-11-08 18:44:46
【问题描述】:
我使用 firebase 在 Xamarin 表单中推送通知,在应用程序打开时工作正常,但在后台测试时我得到了扩展
定位 S+(版本 31 及更高版本)要求在创建 PendingIntent 时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一。
强烈考虑使用 FLAG_IMMUTABLE,仅当某些功能依赖于 PendingIntent 是可变的时才使用 FLAG_MUTABLE,例如如果它需要与内联回复或气泡一起使用。
我搜索了这个错误并找到,应该安装Xamarin.AndroidX.Work.RuntimeNuget包,安装Xamarin.AndroidX.Work.Work.Runtime.KtxNuget 打包并安装Xamarin.Firebase.Analytics,我安装了它们但无法正常工作,仍然出现相同的异常。我该如何解决这个问题?
此日志数据
[AndroidRuntime] 致命异常:Firebase-PNFirebaseMessagingService [AndroidRuntime] 进程:com.raitotec.manaawateer,PID:2365 [AndroidRuntime] java.lang.IllegalArgumentException: com.raitotec.manaawateer:定位 S+(版本 31 及更高版本)需要 在创建时指定 FLAG_IMMUTABLE 或 FLAG_MUTABLE 之一 一个 PendingIntent。 [AndroidRuntime] 强烈考虑使用 FLAG_IMMUTABLE,仅在某些功能依赖于时才使用 FLAG_MUTABLE PendingIntent 是可变的,例如如果它需要与 内联回复或气泡。 [AndroidRuntime] 在 android.app.PendingIntent.checkFlags(PendingIntent.java:378) [AndroidRuntime] 在 android.app.PendingIntent.getActivityAsUser(PendingIntent.java:461) [AndroidRuntime] 在 android.app.PendingIntent.getActivity(PendingIntent.java:447) [AndroidRuntime] 在 android.app.PendingIntent.getActivity(PendingIntent.java:411) [AndroidRuntime] 在 com.google.firebase.messaging.zza.zzh(未知 来源:124) [AndroidRuntime] 在 com.google.firebase.messaging.FirebaseMessagingService.zzd(未知 来源:57) [AndroidRuntime] 在 com.google.firebase.iid.zzc.run(Unknown Source:2) [AndroidRuntime] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137) [AndroidRuntime] 在 java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637) [AndroidRuntime] 在 com.google.android.gms.common.util.concurrent.zza.run(未知 来源:6) [AndroidRuntime] at java.lang.Thread.run(Thread.java:1012)
【问题讨论】:
标签: android xamarin xamarin.forms xamarin.android