Merge pull request #8365 from af7567/notifications

Use unique requestcode for notification PendingIntents
This commit is contained in:
Tobias Kaminsky 2021-08-06 11:25:49 +02:00 committed by GitHub
commit eceb3a13d4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View file

@ -76,7 +76,8 @@ public class DeckApiImpl implements DeckApi {
private PendingIntent createPendingIntent(@NonNull Intent intent, @NonNull Notification notification, @NonNull User user) { private PendingIntent createPendingIntent(@NonNull Intent intent, @NonNull Notification notification, @NonNull User user) {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return PendingIntent.getActivity(context, 0, putExtrasToIntent(intent, notification, user), return PendingIntent.getActivity(context, notification.getNotificationId(),
putExtrasToIntent(intent, notification, user),
PendingIntent.FLAG_ONE_SHOT); PendingIntent.FLAG_ONE_SHOT);
} }

View file

@ -156,7 +156,8 @@ class NotificationWork constructor(
} }
intent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName) intent.putExtra(KEY_NOTIFICATION_ACCOUNT, user.accountName)
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP) intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
pendingIntent = PendingIntent.getActivity(context, 0, intent, PendingIntent.FLAG_ONE_SHOT) pendingIntent = PendingIntent.getActivity(context, notification.getNotificationId(), intent,
PendingIntent.FLAG_ONE_SHOT)
} }
val pushNotificationId = randomId.nextInt() val pushNotificationId = randomId.nextInt()