@@ -110,7 +110,7 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
110110 // recreate pending intent
111111 val mainIntent = Intent (PushNotificationBroadcastReceiver .Actions .SHOW_SCHEDULED_NOTIFICATION )
112112 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 )
114114 // cancel notification via alarm manager
115115 val alarmManager = reactApplicationContext.getSystemService(Context .ALARM_SERVICE ) as AlarmManager
116116 alarmManager.cancel(pendingIntent)
@@ -185,7 +185,7 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
185185 data.entryIterator.forEach {
186186 mainIntent.putExtra(it.key, if (it.value == null ) null else it.value.toString())
187187 }
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 )
189189
190190 // prepare base notification builder
191191 val builder = NotificationCompat .Builder (reactApplicationContext, channelId)
@@ -231,15 +231,15 @@ class PushNotificationModule(reactContext: ReactApplicationContext) : ReactConte
231231 val openUrlIntent = Intent (PushNotificationBroadcastReceiver .Actions .OPEN_URL )
232232 openUrlIntent.component = ComponentName (reactApplicationContext, getDefaultBroadcastReceiverClassName())
233233 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 )
235235 builder.setContentIntent(openUrlPendingIntent)
236236 }
237237 }
238238 // on check button click send CLOSE_NOTIFICATION action to broadcast receiver that closes notification
239239 val closeNotificationIntent = Intent (PushNotificationBroadcastReceiver .Actions .CLOSE_NOTIFICATION )
240240 closeNotificationIntent.component = ComponentName (reactApplicationContext, getDefaultBroadcastReceiverClassName())
241241 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 )
243243 remoteViews.setOnClickPendingIntent(R .id.buttonCheck, closeNotificationPendingIntent)
244244 // set notification template
245245 builder.setContent(remoteViews)
0 commit comments