summaryNotificationMessage

abstract fun summaryNotificationMessage(notificationsAmount: Int): String

Returns the message text displayed in the summary notification.

This text appears in the collapsed summary notification that represents multiple grouped notifications. It should provide a clear indication of how many notifications are in the group and what they're about.

Best Practices:

  • Include the notification count for clarity
  • Use plural forms appropriately (1 message vs 2 messages)
  • Keep the text concise (under 40 characters is ideal)
  • Localize the text for international audiences
Example - Basic count message:

  
  public String summaryNotificationMessage(int notificationsAmount) {
      return notificationsAmount + " new messages";
  }
Example - Proper pluralization:

  
  public String summaryNotificationMessage(int notificationsAmount) {
      if (notificationsAmount == 1) {
          return "1 new message";
      } else {
          return notificationsAmount + " new messages";
      }
  }
Example - Localized with resources:

  
  public String summaryNotificationMessage(int notificationsAmount) {
      Resources res = getApplicationContext().getResources();
      return res.getQuantityString(
          R.plurals.notification_summary,
          notificationsAmount,
          notificationsAmount
      );
  }

  // In res/values/strings.xml:
  // <plurals name="notification_summary">
  //     <item quantity="one">%d new message</item>
  //     <item quantity="other">%d new messages</item>
  // </plurals>

Return

Summary message text to display. Empty string will hide the summary text.

Parameters

notificationsAmount

Number of notifications in the group