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

Commit

Permalink
Merge pull request #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 Aug 30, 2021
2 parents 0ceebc4 + 8d7ab95 commit 381889d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,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 @@ -451,7 +451,7 @@ public void sendToNotificationCentreWithPicture(Bundle bundle, Bitmap largeIconB
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 381889d

Please sign in to comment.