2016-08-12 90 views
1

我目前显示此通知:如何显示在状态栏上一个通知图标多个通知

NotificationCompat.Builder noBuilder = new NotificationCompat.Builder(this) 
    .setSound(sound) 
    .setSmallIcon(R.drawable.h) 
    .setLargeIcon(largeIcon) 
    .setContentTitle(title) 
    .setFullScreenIntent(pendingIntent,true) 
    .setContentText(message) 
    .setStyle(new NotificationCompat.BigTextStyle() 
    .bigText(message)) 
    .setAutoCancel(true) 
    .setPriority(Notification.PRIORITY_HIGH) 
    .setContentIntent(pendingIntent); 

回答

5

使用setGroup()键显示在组通知。

final static String GROUP_KEY_EMAILS = "group_key_emails"; 

// Build the notification, setting the group appropriately 
Notification notif = new NotificationCompat.Builder(mContext) 
     .setContentTitle("New mail from " + sender1) 
     .setContentText(subject1) 
     .setSmallIcon(R.drawable.new_mail) 
     .setGroup(GROUP_KEY_EMAILS) 
     .build(); 

// Issue the notification 
NotificationManagerCompat notificationManager = 
     NotificationManagerCompat.from(this); 
notificationManager.notify(notificationId1, notif); 

设置setGroupSummary()为一组通知

+0

它的工作的集汇总。谢谢 – felix

相关问题