mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
support notification badge/dot
This commit is contained in:
@@ -235,6 +235,7 @@ public class NotificationCenter {
|
||||
channel.setDescription("Informs about new messages.");
|
||||
channel.setGroup(getNotificationChannelGroup(notificationManager));
|
||||
channel.enableVibration(defaultVibrate);
|
||||
channel.setShowBadge(true);
|
||||
|
||||
if (!ledColor.equals("none")) {
|
||||
channel.enableLights(true);
|
||||
@@ -347,6 +348,14 @@ public class NotificationCenter {
|
||||
}
|
||||
} catch (Exception e) { Log.w(TAG, e); }
|
||||
|
||||
// messages count, some os make some use of that
|
||||
// - do not use setSubText() as this is displayed together with setContentInfo() eg. on Lollipop
|
||||
// - setNumber() may overwrite setContentInfo(), should be called last
|
||||
// weird stuff.
|
||||
int cnt = dcContext.getFreshMsgCount(chatId);
|
||||
builder.setContentInfo(String.valueOf(cnt));
|
||||
builder.setNumber(cnt);
|
||||
|
||||
// add notification, we use one notification per chat,
|
||||
// esp. older android are not that great at grouping
|
||||
notificationManager.notify(ID_MSG_OFFSET+chatId, builder.build());
|
||||
|
||||
Reference in New Issue
Block a user