Skip to content

Commit e601762

Browse files
authored
Merge pull request #3 from ChefSteps/cw-3765-pendingintent-android12
SOL-3765: Fix Android 12 notification crash - PendingIntent PendingIntent.FLAG_IMMUTABLE
2 parents ff8138a + 59987a7 commit e601762

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private PendingIntent toScheduleNotificationIntent(Bundle bundle) {
7373
notificationIntent.putExtra(RNPushNotificationPublisher.NOTIFICATION_ID, notificationID);
7474
notificationIntent.putExtras(bundle);
7575

76-
return PendingIntent.getBroadcast(context, notificationID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
76+
return PendingIntent.getBroadcast(context, notificationID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
7777
}
7878

7979
public void sendNotificationScheduled(Bundle bundle) {
@@ -322,7 +322,7 @@ public void sendToNotificationCentre(Bundle bundle) {
322322
int notificationID = Integer.parseInt(notificationIdString);
323323

324324
PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationID, intent,
325-
PendingIntent.FLAG_UPDATE_CURRENT);
325+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
326326

327327
NotificationManager notificationManager = notificationManager();
328328
checkOrCreateChannel(notificationManager);
@@ -366,7 +366,7 @@ public void sendToNotificationCentre(Bundle bundle) {
366366
actionIntent.putExtra("notification", bundle);
367367

368368
PendingIntent pendingActionIntent = PendingIntent.getActivity(context, notificationID, actionIntent,
369-
PendingIntent.FLAG_UPDATE_CURRENT);
369+
PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
370370
notification.addAction(icon, action, pendingActionIntent);
371371
}
372372
}

0 commit comments

Comments
 (0)