Skip to content

Commit 7a205ed

Browse files
committed
Add workaround to override Android 16 system grouping
Signed-off-by: Kyle Corry <kylecorry31@gmail.com>
1 parent c776287 commit 7a205ed

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import com.vanniktech.maven.publish.AndroidSingleVariantLibrary
22
import com.vanniktech.maven.publish.SonatypeHost
33

4-
val versionName = "15.0.0"
4+
val versionName = "15.1.0"
55
val groupId = "com.kylecorry.andromeda"
66

77
buildscript {

notify/src/main/java/com/kylecorry/andromeda/notify/Notify.kt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,25 @@ object Notify {
3737
}
3838
}
3939

40-
fun send(context: Context, notificationId: Int, notification: Notification) {
41-
getNotificationManager(context)?.notify(notificationId, notification)
40+
fun send(
41+
context: Context,
42+
notificationId: Int,
43+
notification: Notification,
44+
overrideSystemGrouping: Boolean = false,
45+
groupSummaryNotificationId: Int = notificationId
46+
) {
47+
val manager = getNotificationManager(context)
48+
if (overrideSystemGrouping && Build.VERSION.SDK_INT >= Build.VERSION_CODES.BAKLAVA) {
49+
val summary = NotificationCompat
50+
.Builder(context, notification)
51+
.setGroupSummary(true)
52+
.setSound(null)
53+
.setVibrate(null)
54+
.build()
55+
manager?.notify(groupSummaryNotificationId, summary)
56+
}
57+
58+
manager?.notify(notificationId, notification)
4259
}
4360

4461
/**

0 commit comments

Comments
 (0)