Skip to content

Commit

Permalink
Merge pull request zo0r#2130 from cristianoccazinsp/patch-1
Browse files Browse the repository at this point in the history
Fix Android 12 PendingIntent
  • Loading branch information
Boris Tacyniak authored and azundo committed Nov 3, 2022
1 parent b4ea8fb commit ea4b662
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ private PendingIntent toScheduleNotificationIntent(Bundle bundle) {
notificationIntent.putExtra(RNPushNotificationPublisher.NOTIFICATION_ID, notificationID);
notificationIntent.putExtras(bundle);

return PendingIntent.getBroadcast(context, notificationID, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT);
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);
}

public void sendNotificationScheduled(Bundle bundle) {
Expand Down Expand Up @@ -323,7 +323,7 @@ public void sendToNotificationCentre(Bundle bundle) {
int notificationID = Integer.parseInt(notificationIdString);

PendingIntent pendingIntent = PendingIntent.getActivity(context, notificationID, intent,
PendingIntent.FLAG_UPDATE_CURRENT);
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ? PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE : PendingIntent.FLAG_UPDATE_CURRENT);

NotificationManager notificationManager = notificationManager();
checkOrCreateChannel(notificationManager);
Expand Down

0 comments on commit ea4b662

Please sign in to comment.