Notification not shown when setGroup() is called in Android KitKat

后端 未结 2 1114
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 09:01

I\'m testing the stackable notifications (Stacking Notifications article).

I detected that in some cases the notifications are not shown after the notify()

2条回答
  •  無奈伤痛
    2021-02-05 09:31

    The solution of George is technically right but is not user-friendly because is based on a NotificationListener that has to be enabled manually from phone security setting by user.

    I find this working method, set setGroupSummary(true) also to which ones that represent single notification and notify everyone with same id that specify the category of the notification (e.g. messages instead single conversation). If no particular grouping style is applied, the notification is posted as a normal non-grouped one. If a grouped one is posted, it will replace any single notification because have all the same id.

    Telegram for Android apply this technique to group notifications also on KitKat and lower.

提交回复
热议问题