mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
use correct SDK for grouping summary
This commit is contained in:
@@ -483,16 +483,18 @@ public class NotificationCenter {
|
||||
// esp. older android are not that great at grouping
|
||||
notificationManager.notify(ID_MSG_OFFSET + chatId, builder.build());
|
||||
|
||||
// group notifications together in a summary
|
||||
if (Build.VERSION.SDK_INT >= 23) {
|
||||
// group notifications together in a summary, this is possible since SDK 24 (Android 7)
|
||||
// https://developer.android.com/training/notify-user/group.html
|
||||
// in theory, this won't be needed due to setGroup(), however, in practise, it is needed up to at least Android 10.
|
||||
if (Build.VERSION.SDK_INT >= 24) {
|
||||
NotificationCompat.Builder summary = new NotificationCompat.Builder(context, notificationChannel)
|
||||
.setGroup(GRP_MSG)
|
||||
.setGroupSummary(true)
|
||||
.setSmallIcon(R.drawable.icon_notification)
|
||||
.setColor(context.getResources().getColor(R.color.delta_primary))
|
||||
.setCategory(NotificationCompat.CATEGORY_MESSAGE)
|
||||
.setContentTitle("summary title")
|
||||
.setContentText("summary text")
|
||||
.setContentTitle("Delta Chat") // content title would only be used on SDK <24
|
||||
.setContentText("New messages") // content text would only be used on SDK <24
|
||||
.setContentIntent(getOpenChatlistIntent());
|
||||
notificationManager.notify(ID_MSG_SUMMARY, summary.build());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user