Conversations

Android 11 makes a number of improvements to the way conversations are handled. Conversations are communications that:

  • Are in real-time.
  • Are bidirectional or multidirectional, not one-way.
  • Are among two or more people (not bots).

These conversations are now presented in their own area, and notifications for these conversations are highlighted and given extra functionality:

  • If the user long-presses on a conversation notification, the system offers them several choices:
    • Promote the conversation to a bubble, if the app supports bubbles.
    • Create a shortcut for this conversation and add it to the home screen.
    • Silence or snooze notifications for this conversation.
    • Mark this conversation as very important.
  • The notification's design uses a new version of MessagingStyle that emphasizes an avatar representing people, combined with the icon for the app carrying on the conversation.

To identify a conversation so it gets this special handling, your app needs to publish a shortcut to the conversation by calling ShortcutManager methods. Call setDynamicShortcuts() to replace all the existing shortcuts, or addDynamicShortcuts() to add new shortcuts without removing the existing ones. You can also call the new method pushDynamicShortCut() to add a single shortcut. Conversation shortcuts must be long-lived and have persons data attached, identifying the other participants in the conversation. We also recommend that you set the LocusId for the shortcut and annotate the in-app activities and fragments with that LocusId. Doing so helps the system to accurately rank conversations based on app usage.

If a conversation no longer exists, the app can delete the shortcut with ShortcutManager.removeLongLivedShortcuts(); doing so causes the system to delete all data associated with the conversation.

When your app sends a notification related to a conversation, you must use MessagingStyle and include a link to the conversation shortcut. Doing so enables the system to give your notification the special conversation handling.

Based on user behavior, the system may designate certain conversations as being especially important and cache them, displaying them more prominently. Your app cannot influence whether your conversations get this priority treatment, but you can find out which conversations are currently cached by calling the new method ShortcutManager.getShortcuts() and passing FLAG_MATCH_CACHED.