首页 > 如何让Android通知栏里来自同一来源的通知集中?

如何让Android通知栏里来自同一来源的通知集中?

如图,网易新闻的所有通知可以无视手机里通知的先后顺序,全部集中在一起。

http://developer.android.com/intl/zh-cn/reference/android/app/Notification.Builder.html#setGroup(java.lang.String)
我参考了官方文档里面的setGroup()方法,在新建Notification的时候都设置了同一个group,但似乎没有效果。

    NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context)
            .setContent(normalView)
            .setContentTitle(titleText)
            .setContentText(contentText)
            .setSmallIcon(icon)
            .setTicker(contentText)
            .setContentIntent(intent)
            .setGroup("Group1")
            .setAutoCancel(true);
mNotificationManager.notify(notifyId, notificationBuilder.build());

请教各位有什么正确的方法实现这种效果?谢谢。

【热门文章】
【热门文章】