-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Conversation
Fix Android 12 (SDK 31) notifications due to missing PendingIntent flags.
Hi @cristianoccazinsp |
Thanks for merging, I think I missed this line too: https://github.com/cristianoccazinsp/react-native-push-notification/blob/8d7ab959f574984bac7df50f5adb84bdb5e04b88/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L531 @Dallas62 Can you update that line with the same logic before releasing? |
Hi @cristianoccazinsp |
@Dallas62 I think the issue may be related to using |
You can try to change : by: int flags = PendingIntent.FLAG_UPDATE_CURRENT;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if(action.equals("ReplyInput")) {
flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_MUTABLE;
}
else {
flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
}
} Regards |
That seems like an even more reasonable fix, checking for reply input as well. What are the side effects of marking an intent as mutable? |
The current fix has broken ReplyInput. @Dallas62 |
Fix Android 12 PendingIntent
Fix Android 12 PendingIntent
Fix Android 12 (SDK 31) notifications due to missing PendingIntent flags.
Fixes #2129
I've tested this on a Pixel 5 with Android 12 and a RN app compiled with SDK 31. However, I've only tested local notifications, but I expect that the change should work across all notifications as it is very simple.