onMessagesGroupOpened
Callback invoked when a user taps on a grouped notification (notification stack).
On Android, when multiple notifications from your app are displayed, they can be automatically grouped into a single expandable notification. This method is called when the user taps on the grouped notification or its summary.
By default, this method opens the most recent notification by calling handleNotification with the last message in the list. Override this method to implement custom behavior, such as showing a list of all messages or opening a summary screen. Example:
protected void onMessagesGroupOpened(List<PushMessage> messages) {
Context context = getApplicationContext();
// Create intent to summary screen
Intent intent = new Intent(context, NotificationSummaryActivity.class);
// Pass all message IDs
ArrayList<String> messageIds = new ArrayList<>();
for (PushMessage msg : messages) {
String id = msg.getCustomData().getString("message_id");
messageIds.add(id);
}
intent.putStringArrayListExtra("message_ids", messageIds);
intent.putExtra("count", messages.size());
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(intent);
// Track group open
Analytics.track("notification_group_opened", messages.size());
}
Content copied to clipboard
Parameters
messages
list of push messages in the group that was opened, ordered from oldest to newest