I am working on the push notification integration of my Flutter application and have been facing the following issue with the Android build of the app regarding a “PendingIntent” requiring a “FLAG_IMMUTABLE” argument.
I found the following support thread regarding a similar issue
https://support.backendless.com/t/push-notifications-causing-a-crash-when-targeting-android-api-31/14513/6 but the solution applied in the Backendless Android SDK 6.3.6 seems to have not worked for the template-based pushes from the Backendless console.
These looks to be the relevant lines in the Backendless Android SDK:
https://github.com/Backendless/Android-SDK/blob/bc7e1970b076e63efded913fed2ae346b7ea554a/src/com/backendless/push/BackendlessFCMService.java#L134
Since template-based pushing currently fails, is there a method through the Backendless console of sending push notifications that are not template based?
Backendless Version (3.x / 5.x, Online / Managed / Pro )
Online
Client SDK (REST / Android / Objective-C / Swift / JS )
Backendless Flutter SDK: 7.2.7
Backendless Android SDK: 6.3.6
Application ID
73AE4526-D543-4DFD-9527-5CD98C67BB53
Expected Behavior
Please describe the expected behavior of the issue, starting from the first action.
- Send a push notification template from the Backendless Console
- Push notification is handled while mobile app is backgrounded
Actual Behavior
- Send a push notification template from the Backendless Console
- Push notification handler crashes with the following:
E/BackendlessFCMService( 3090): Error processing push notification
E/BackendlessFCMService( 3090): java.lang.IllegalArgumentException: us.boundlessdesign.customer_support_blue: Targeting S+ (version 31 and above) requires that one of FLAG_IMMUTABLE or FLAG_MUTABLE be specified when creating a PendingIntent.
E/BackendlessFCMService( 3090): 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/BackendlessFCMService( 3090): at android.app.PendingIntent.checkFlags(PendingIntent.java:375)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivityAsUser(PendingIntent.java:458)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivity(PendingIntent.java:444)
E/BackendlessFCMService( 3090): at android.app.PendingIntent.getActivity(PendingIntent.java:408)
E/BackendlessFCMService( 3090): at com.backendless.push.PushTemplateHelper.convertFromTemplate(PushTemplateHelper.java:267)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.handleMessageWithTemplate(BackendlessFCMService.java:134)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.handleMessage(BackendlessFCMService.java:102)
E/BackendlessFCMService( 3090): at com.backendless.push.BackendlessFCMService.onMessageReceived(BackendlessFCMService.java:68)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.dispatchMessage(FirebaseMessagingService.java:235)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.passMessageIntentToSdk(FirebaseMessagingService.java:185)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.handleMessageIntent(FirebaseMessagingService.java:172)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.FirebaseMessagingService.handleIntent(FirebaseMessagingService.java:161)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.EnhancedIntentService.lambda$processIntent$0$EnhancedIntentService(EnhancedIntentService.java:78)
E/BackendlessFCMService( 3090): at com.google.firebase.messaging.-$$Lambda$EnhancedIntentService$NSk2h75eWhBOI4TsAFgvvtv1g9o.run(Unknown Source:6)