我有一个推送通知问题后,升级到31 android,应用程序崩溃时,接收推送通知android 12或以上的设备
一个信号_ Flutter :^2.6.4
构建脚本{存储库{ maven { url 'https://plugins.gradle.org/m2/'}}依赖项{类路径'gradle.plugin.com.单信号:单信号-gradle-插件:[0.12.4,0.99.99]' } }
实现'com.onesignal:一个信号:3.13.1'
E/AndroidRuntime(22706): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4480)
E/AndroidRuntime(22706): at android.app.ActivityThread.access$1800(ActivityThread.java:277)
E/AndroidRuntime(22706): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2181)
E/AndroidRuntime(22706): at android.os.Handler.dispatchMessage(Handler.java:106)
E/AndroidRuntime(22706): at android.os.Looper.loopOnce(Looper.java:211)
E/AndroidRuntime(22706): at android.os.Looper.loop(Looper.java:300)
E/AndroidRuntime(22706): at android.app.ActivityThread.main(ActivityThread.java:8282)
E/AndroidRuntime(22706): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime(22706): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:576)
E/AndroidRuntime(22706): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1074)
E/AndroidRuntime(22706): Caused by: java.lang.IllegalArgumentException: com.myapp: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/AndroidRuntime(22706): 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.
E/AndroidRuntime(22706): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/AndroidRuntime(22706): at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:645)
E/AndroidRuntime(22706): at android.app.PendingIntent.getBroadcast(PendingIntent.java:632)
E/AndroidRuntime(22706): at com.onesignal.GenerateNotification.getNewActionPendingIntent(GenerateNotification.java:189)
E/AndroidRuntime(22706): at com.onesignal.GenerateNotification.createGenericPendingIntentsForNotif(GenerateNotification.java:398)
E/AndroidRuntime(22706): at com.onesignal.GenerateNotification.showNotification(GenerateNotification.java:382)
E/AndroidRuntime(22706): at com.onesignal.GenerateNotification.fromJsonPayload(GenerateNotification.java:110)
E/AndroidRuntime(22706): at com.onesignal.NotificationBundleProcessor.ProcessJobForDisplay(NotificationBundleProcessor.java:107)
E/AndroidRuntime(22706): at com.onesignal.NotificationBundleProcessor.ProcessFromGCMIntentService(NotificationBundleProcessor.java:90)
E/AndroidRuntime(22706): at com.onesignal.GcmBroadcastReceiver.startGCMService(GcmBroadcastReceiver.java:138)
E/AndroidRuntime(22706): at com.onesignal.GcmBroadcastReceiver.processOrderBroadcast(GcmBroadcastReceiver.java:129)
E/AndroidRuntime(22706): at com.onesignal.GcmBroadcastReceiver.onReceive(GcmBroadcastReceiver.java:70)
E/AndroidRuntime(22706): at android.app.ActivityThread.handleReceiver(ActivityThread.java:4467)
1条答案
按热度按时间af7jpaap1#
将库更新到最新版本release notes OneSignal:和flutter,因为从Android 12开始有新的要求,如消息所示: