Group Messaging in Android Auto

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

Posted by David Nelloms, Software Engineer

Communicating with a group of people is a common use case for many messaging
apps. However, it may be difficult to know how the Android
Auto messaging API applies to group conversations. Here are some tips for
getting started with group messaging in Android Auto:

Conversation Name

When constructing the UnreadConversation builder, you are required to pass in a
name. This is the name of the conversation that is displayed to the user when
messages arrive.

UnreadConversation.Builder unreadConvBuilder =
    new UnreadConversation.Builder(conversationName)
        .setReplyAction(msgReplyPendingIntent, remoteInput);

For one-on-one conversations, this is simply the name of the other participant.
For group conversations, it is best to choose one of two options for the name:

  1. Conversation title: If your app supports adding a title to group
    conversations, use the title for the name parameter to be consistent with your
    in-app experience. This field is similar to NotificationCompat.MessagingStyle#setConversationTitle.

  2. A list of participants: Build a comma-separated list of participants for the
    name parameter to identify the group. Note that this is read aloud by the
    text-to-speech system, so you may need to abbreviate the list for large groups.
    You should balance allowing users to uniquely identify the group with the time
    taken to listen to messages.

Text to Speech Formatting

Getting text to sound natural using a TTS system is a challenging problem.
There are teams working hard to improve this, but there are steps you can take
to create a better user experience with the current capabilities. The Android
Auto messaging API does not yet have an option for pairing participants with
individual messages in a group conversation. This is problematic for drivers
when there are multiple unread messages from multiple participants in a group
conversation, as the drivers cannot see which group member sent which message.
One solution is to prepend the sender’s name to the message whenever the sender
changes so that the names are read aloud to the driver.

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

CharSequence currentSender = null;
for (Message message : myMessages) {
    StringBuilder messageText = new StringBuilder();
    CharSequence sender = message.getSender();
    // Maybe append sender to indicate who is speaking.
    if (!TextUtils.isEmpty(sender) && !sender.equals(currentSender)) {
        if (currentSender != null) {
            // Punctuation will briefly pause TTS readout between senders.
            messageText.append(". ");
        currentSender = sender;
        // Punctuation will separate sender from message in TTS readout.
        messageText.append(": ");

Some things to note about the above sample code:

  • Adding punctuation is not strictly necessary, but it can produce a more
    natural sounding result.

  • The sender names are converted to lowercase. This is workaround for a quirk
    where the TTS implementation vocalizes “. ” as “dot” when preceding a capital
    letter on some devices.

Get participants

In searching for how to handle group messaging, you may have noticed UnreadConversation#getParticipants.
This can be confusing as there is no mechanism to add multiple participants in
the builder. The builder implementation populates the array with the
conversation name passed to its constructor. Internally, Android Auto uses the
singular UnreadConversation#getParticipant,
which returns the first element of the participants array, to populate the title
in the notification view.

Stay tuned

The Android Auto team is working on ways to make messaging with drivers simpler
and more intuitive for app developers. Stay tuned for future updates so that
you can continue to deliver a great user experience!

Android Developers Blog

Your ads will be inserted here by

Easy Ads.

Please go to the plugin admin page to set up your ad code.

Leave a Reply

Your email address will not be published. Required fields are marked *


* Copy This Password *

* Type Or Paste Password Here *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>