Skip to content
This repository was archived by the owner on Jan 14, 2025. It is now read-only.

Commit 9b5c7f7

Browse files
committed
Complete fix of #2130.
1 parent 57be563 commit 9b5c7f7

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,9 @@ private PendingIntent toScheduleNotificationIntent(Bundle bundle) {
109109
notificationIntent.putExtra(RNPushNotificationPublisher.NOTIFICATION_ID, notificationID);
110110
notificationIntent.putExtras(bundle);
111111

112-
return PendingIntent.getBroadcast(context, notificationID, notificationIntent, Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT);
112+
int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
113+
114+
return PendingIntent.getBroadcast(context, notificationID, notificationIntent, flags);
113115
} catch (Exception e) {
114116
Log.e(LOG_TAG, "Unable to parse Notification ID", e);
115117
}
@@ -531,8 +533,10 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
531533
intent.putExtra("message_id", messageId);
532534
}
533535

534-
PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent,
535-
PendingIntent.FLAG_UPDATE_CURRENT);
536+
int flags = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT;
537+
538+
PendingIntent pendingActionIntent = PendingIntent.getBroadcast(context, notificationID, actionIntent, flags);
539+
536540
if(action.equals("ReplyInput")){
537541
//Action with inline reply
538542
if(android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT_WATCH){

0 commit comments

Comments
 (0)