@@ -110,7 +110,7 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
110
110
// recreate pending intent
111
111
val mainIntent = Intent (PushNotificationBroadcastReceiver .Actions .SHOW_SCHEDULED_NOTIFICATION )
112
112
mainIntent.component = ComponentName (reactApplicationContext, getDefaultBroadcastReceiverClassName())
113
- val pendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, mainIntent, PendingIntent .FLAG_UPDATE_CURRENT )
113
+ val pendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, mainIntent, PendingIntent .FLAG_UPDATE_CURRENT or PendingIntent . FLAG_IMMUTABLE )
114
114
// cancel notification via alarm manager
115
115
val alarmManager = reactApplicationContext.getSystemService(Context .ALARM_SERVICE ) as AlarmManager
116
116
alarmManager.cancel(pendingIntent)
@@ -185,7 +185,7 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
185
185
data.entryIterator.forEach {
186
186
mainIntent.putExtra(it.key, if (it.value == null ) null else it.value.toString())
187
187
}
188
- val pendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, mainIntent, PendingIntent .FLAG_UPDATE_CURRENT )
188
+ val pendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, mainIntent, PendingIntent .FLAG_UPDATE_CURRENT or PendingIntent . FLAG_IMMUTABLE )
189
189
190
190
// prepare base notification builder
191
191
val builder = NotificationCompat .Builder (reactApplicationContext, channelId)
@@ -231,15 +231,15 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
231
231
val openUrlIntent = Intent (PushNotificationBroadcastReceiver .Actions .OPEN_URL )
232
232
openUrlIntent.component = ComponentName (reactApplicationContext, getDefaultBroadcastReceiverClassName())
233
233
openUrlIntent.putExtra(" url" , data.getString(" url" ))
234
- val openUrlPendingIntent = PendingIntent .getBroadcast(reactApplicationContext, 0 , openUrlIntent, PendingIntent .FLAG_UPDATE_CURRENT )
234
+ val openUrlPendingIntent = PendingIntent .getBroadcast(reactApplicationContext, 0 , openUrlIntent, PendingIntent .FLAG_UPDATE_CURRENT or PendingIntent . FLAG_IMMUTABLE )
235
235
builder.setContentIntent(openUrlPendingIntent)
236
236
}
237
237
}
238
238
// on check button click send CLOSE_NOTIFICATION action to broadcast receiver that closes notification
239
239
val closeNotificationIntent = Intent (PushNotificationBroadcastReceiver .Actions .CLOSE_NOTIFICATION )
240
240
closeNotificationIntent.component = ComponentName (reactApplicationContext, getDefaultBroadcastReceiverClassName())
241
241
closeNotificationIntent.putExtra(" id" , notificationId)
242
- val closeNotificationPendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, closeNotificationIntent, PendingIntent .FLAG_UPDATE_CURRENT )
242
+ val closeNotificationPendingIntent = PendingIntent .getBroadcast(reactApplicationContext, notificationId, closeNotificationIntent, PendingIntent .FLAG_UPDATE_CURRENT or PendingIntent . FLAG_IMMUTABLE )
243
243
remoteViews.setOnClickPendingIntent(R .id.buttonCheck, closeNotificationPendingIntent)
244
244
// set notification template
245
245
builder.setContent(remoteViews)
0 commit comments