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 1d497e6 commit 9f5b329
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,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);
} catch (Exception e) {
Log.e(LOG_TAG, "Unable to parse Notification ID", e);
}
Expand Down Expand Up @@ -404,7 +404,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();

Expand Down

0 comments on commit 9f5b329

Please sign in to comment.