diff --git a/app/src/org/commcare/services/CommCareFirebaseMessagingService.java b/app/src/org/commcare/services/CommCareFirebaseMessagingService.java index f18919395..96826247e 100644 --- a/app/src/org/commcare/services/CommCareFirebaseMessagingService.java +++ b/app/src/org/commcare/services/CommCareFirebaseMessagingService.java @@ -92,11 +92,11 @@ private void showNotification(RemoteMessage.Notification notification) { i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); - PendingIntent contentIntent; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) - contentIntent = PendingIntent.getActivity(this, 0, i, PendingIntent.FLAG_IMMUTABLE); - else - contentIntent = PendingIntent.getActivity(this, 0, i, 0); + int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + pendingIntentFlags = pendingIntentFlags | PendingIntent.FLAG_IMMUTABLE; + } + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, i, pendingIntentFlags); NotificationCompat.Builder fcmNotification = new NotificationCompat.Builder(this, CommCareNoficationManager.NOTIFICATION_CHANNEL_PUSH_NOTIFICATIONS_ID) diff --git a/app/src/org/commcare/services/CommCareSessionService.java b/app/src/org/commcare/services/CommCareSessionService.java index 7aa18dcdc..7e3770423 100644 --- a/app/src/org/commcare/services/CommCareSessionService.java +++ b/app/src/org/commcare/services/CommCareSessionService.java @@ -706,12 +706,11 @@ private Notification createSessionNotification(){ callable.setAction("android.intent.action.MAIN"); callable.addCategory("android.intent.category.LAUNCHER"); - // The PendingIntent to launch our activity if the user selects this notification - PendingIntent contentIntent; - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) - contentIntent = PendingIntent.getActivity(this, 0, callable, PendingIntent.FLAG_IMMUTABLE); - else - contentIntent = PendingIntent.getActivity(this, 0, callable, 0); + int pendingIntentFlags = PendingIntent.FLAG_UPDATE_CURRENT; + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + pendingIntentFlags = pendingIntentFlags | PendingIntent.FLAG_IMMUTABLE; + } + PendingIntent contentIntent = PendingIntent.getActivity(this, 0, callable, pendingIntentFlags); String notificationText; if (AppUtils.getInstalledAppRecords().size() > 1) {