Skip to content

App crashes when targeting version 31 and above when hitting "notification:received" #86

@lkellett-tfo

Description

@lkellett-tfo

Hi, I've got an issue when running the app with target SDK 31 / Android 12. The app builds fine, but crashes almost immediately after receiving a notification. A notification does not actually appear, but a breakpoint in window.plugins.PushbotsPlugin.on("notification:received", function (data) {}) was hit.

Android Studio: 2021.3.1 Patch 1 (Mac Intel)
minSdkVersion 24
targetSdkVersion 31
Cordova 10.0.0
cordova android 11.0.0
pushbots-cordova-plugin: 1.6.21

java.lang.IllegalArgumentException: test.exampleco.exampleapp: 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.
	at android.app.PendingIntent.checkFlags(PendingIntent.java:377)
	at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:460)
	at android.app.PendingIntent.getActivity(PendingIntent.java:446)
	at android.app.PendingIntent.getActivity(PendingIntent.java:410)
	at com.pushbots.push.PBNotificationIntent.createNotification(PBNotificationIntent.java:485)
	at com.pushbots.push.PBNotificationIntent.buildNotification(PBNotificationIntent.java:88)
	at com.pushbots.push.PBNotification.generateNotificationInner(PBNotification.java:78)
	at com.pushbots.push.PBNotification.generateNotification(PBNotification.java:71)
	at com.pushbots.push.PBGenerateNotification.generateNotification(PBGenerateNotification.java:120)
	at com.pushbots.push.PBGenerateNotification.generateNotification(PBGenerateNotification.java:94)
	at com.pushbots.push.GcmIntentJobService.startProcessing(GcmIntentJobService.java:78)
	at com.pushbots.push.PBJobServiceBase$1.run(PBJobServiceBase.java:23)
	at java.lang.Thread.run(Thread.java:920)

This appears that as the plugin has not been updated in some time, it breaks compatibility with this SDK version. It's not something I can try and fix directly as the issue is in the core com.pushbots.push package. Is this plugin able to be updated? Or maybe it is something on my end? Thanks for having a look.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions