When your app creates more than one notification about the same type, you should traditionally update the existing notification with a summary of all the notifications instead of creating multiple notifications. For instance, instead of three notifications for each received email, you should create one with a summary such as "3 new messages." To view the contents of each message, the user must then touch the notification to open your app.
However, when a user is viewing your notifications on a wearable device, you can create a stack that collects all the notifications for immediate access without creating multiple cards in the card stream.
For details about designing notification stacks, see the Design Principles of Android Wear.
Add Each Notification to a Group
To create a stack, call
setGroup() for each notification you want in the stack, passing the same
group key. For example:
final static String GROUP_KEY_EMAILS = "group_key_emails";
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender)
.setContentText(subject)
.setSmallIcon(R.drawable.new_mail);
Notification notif = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS)
.build();
By default, notifications appear in the order in which you added them, with the most recent
notification visible at the top. You can define a specific position in the group
by passing an order position as the second parameter for
setGroup().
Add a Summary Notification
It's important that you still provide a summary notification for handheld devices. So in
addition to adding each unique notification to the same stack group, also add the summary
notification but set its order position to be GROUP_ORDER_SUMMARY.
The notification in this position does not appear in the stack on the wearable but
appears as the only notification on the handheld.
Notification summaryNotification = new WearableNotifications.Builder(builder)
.setGroup(GROUP_KEY_EMAILS, WearableNotifications.GROUP_ORDER_SUMMARY)
.build();