Skip to content

Commit

Permalink
fix: Specify PendingIntent.FLAG_IMMUTABLE for Android S+ (#1077)
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Aug 29, 2021
1 parent 6f4a52d commit 3615a37
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public static IntentSender getSharingSenderIntent(ReactContext reactContext) {
intent.setClass(reactContext.getApplicationContext(), TargetChosenReceiver.class);
intent.putExtra(EXTRA_RECEIVER_TOKEN, sLastRegisteredReceiver.hashCode());
final PendingIntent callback = PendingIntent.getBroadcast(reactContext, 0, intent,
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M ?
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_IMMUTABLE :
PendingIntent.FLAG_CANCEL_CURRENT | PendingIntent.FLAG_ONE_SHOT);

return callback.getIntentSender();
Expand Down

0 comments on commit 3615a37

Please sign in to comment.