diff --git a/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java --- a/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java +++ b/native/android/app/src/main/java/app/comm/android/notifications/CommNotificationsHandler.java @@ -39,6 +39,7 @@ private static final String NOTIF_ID_KEY = "id"; private static final String ENCRYPTED_PAYLOAD_KEY = "encryptedPayload"; private static final String ENCRYPTION_FAILED_KEY = "encryptionFailed"; + private static final String COLLAPSE_ID_KEY = "collapseKey"; private static final String CHANNEL_ID = "default"; private static final long[] VIBRATION_SPEC = {500, 500}; @@ -234,6 +235,13 @@ return; } String id = message.getData().get(NOTIF_ID_KEY); + String collapseKey = message.getData().get(COLLAPSE_ID_KEY); + String notificationID = id; + + if (collapseKey != null) { + notificationID = collapseKey; + } + String title = message.getData().get(TITLE_KEY); String prefix = message.getData().get(PREFIX_KEY); String body = message.getData().get(BODY_KEY); @@ -268,10 +276,13 @@ if (!this.notificationGroupingSupported() || threadID == null) { notificationManager.notify( - id, id.hashCode(), notificationBuilder.build()); + notificationID, + notificationID.hashCode(), + notificationBuilder.build()); return; } - this.addToThreadGroupAndDisplay(id, notificationBuilder, threadID); + this.addToThreadGroupAndDisplay( + notificationID, notificationBuilder, threadID); } private PendingIntent