am c79173c7: am 05282133: Merge "docs: Bugfix & minor cleanup for "Providing Messaging for Auto"" into lmp-docs

automerge: b5b9c9b

* commit 'b5b9c9b589c058d9e21ca23976d7574f9c604e38':
  docs: Bugfix & minor cleanup for "Providing Messaging for Auto"
This commit is contained in:
Andrew Solovay
2014-11-21 10:12:52 +00:00
committed by android-build-merger

View File

@ -151,9 +151,9 @@ page.article=true
</p>
<p>
You define the read action and reply action intents types for your app and the {@code
You define the read action and reply action intents types for your app and the {@link
android.content.BroadcastReceiver} classes that handle them in the manifest. The following code
example demonstrates how to declare these intents and thier associated receivers.
example demonstrates how to declare these intents and their associated receivers.
</p>
<pre>
@ -175,7 +175,7 @@ page.article=true
</pre>
<p>
The definition of the {@code android.content.BroadcastReceiver} classes shown in this example
The definition of the {@link android.content.BroadcastReceiver} classes shown in this example
is discussed in <a href="#handle_actions">Handle User Actions</a>.
</p>
@ -187,7 +187,7 @@ page.article=true
<a href="{@docRoot}tools/support-library/features.html#v4">v4 support library</a>. Use the
<a href="{@docRoot}tools/help/sdk-manager.html">Android SDK Manager</a> to update the
<em>Extras > Android Support Repository</em> to version 9 or higher and the
<em>Extras > Android Support Library</em> to version 21.1.0 or higher.
<em>Extras > Android Support Library</em> to version 21.0.2 or higher.
</p>
<p>
@ -199,7 +199,7 @@ page.article=true
<pre>
dependencies {
...
compile 'com.android.support:support-v4:21.1.+'
compile 'com.android.support:support-v4:21.0.+'
}
</pre>
@ -244,14 +244,15 @@ dependencies {
<h3 id="build_conversation">Build message conversations</h4>
<p>
Messaging notifications for Auto organize messages into conversations using the {@code
NotificationCompat.CarExtender.UnreadConversation} class, that represents an unread or new
Messaging notifications for Auto organize messages into conversations using the {@link
android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation} class,
that represents an unread or new
portion of a conversation from a particular sender. It contains a list of messages from the
sender.
</p>
<p>
Use the {@code UnreadConversation.Builder} class to create an unread conversation object,
Use the {@link android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder} class to create an unread conversation object,
as shown in the following example code:
</p>
@ -277,11 +278,12 @@ UnreadConversation.Builder unreadConvBuilder =
</p>
<p>
If your app supports replying to a conversation, you must call the {@code setReplyAction()}
method and provide a pending intent to pass that user action back to your app. The {@code
UnreadConversation} object you create must also include a {@link
android.support.v4.app.RemoteInput} object. This object is required because the Auto user
receiving this conversation speaks a reply, a the remote input objects lets your app get a text
If your app supports replying to a conversation, you must call the {@link android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder#setReplyAction setReplyAction()}
method and provide a pending intent to pass that user action back to your app. The
{@link android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation}
object you create must also include a {@link
android.support.v4.app.RemoteInput} object. When the Auto user
receiving this conversation speaks a reply, the remote input objects lets your app get a text
version of the voice reply.
</p>
@ -289,8 +291,9 @@ UnreadConversation.Builder unreadConvBuilder =
<h4 id="conversation-messages">Associate messages with conversations</h4>
<p>
Messages provided for Auto must be associated with a conversation using the {@code
NotificationCompat.CarExtender.UnreadConversation} class. The following code example shows how
Messages provided for Auto must be associated with a conversation using the
{@link android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation}
class. The following code example shows how
to associate individual messages with a conversation object.
</p>
@ -327,18 +330,18 @@ for (Iterator&lt;String&gt; messages = conversation.getMessages().iterator();
Intent msgHeardIntent = new Intent()
.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES)
.setAction(<em>com.myapp.messagingservice.ACTION_MESSAGE_HEARD</em>)
.putExtra("conversation_id", conversationId);
.putExtra("conversation_id", <em>conversationId</em>);
PendingIntent msgHeardPendingIntent =
PendingIntent.getBroadcast(getApplicationContext(),
conversationId,
<em>conversationId</em>,
msgHeardIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
</pre>
<p>
In this example, {@code conversationId} is an integer that identifies the current conversation.
The value of {@code setAction()} is an intent filter identifier for heard messages which is
The value of {@link android.content.Intent#setAction setAction()} is an intent filter identifier for heard messages which is
defined in your app manifest, as shown in <a href="#manifest-intent">Define read and reply intent
filters</a>.
</p>
@ -365,7 +368,7 @@ PendingIntent msgReplyPendingIntent = PendingIntent.getBroadcast(
<p>
Once again, {@code conversationId} is an integer that uniquely identifies this conversation. The
value of {@code setAction()} is an intent filter identifier for replies which is defined in your
value of {@link android.content.Intent#setAction setAction()} is an intent filter identifier for replies which is defined in your
app manifest, as shown in <a href="#manifest-intent">Define read and reply intent filters</a>.
</p>
@ -377,8 +380,9 @@ PendingIntent msgReplyPendingIntent = PendingIntent.getBroadcast(
notification to Auto.
</p>
<p>First, add the message to the <code>UnreadConversation.Builder</code> for
this conversation, and update its timestamp:</p>
<p>First, add the message to the {@link
android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation.Builder}
for this conversation, and update its timestamp:</p>
<pre>
unreadConvBuilder.addMessage(<em>messageString</em>)
@ -402,10 +406,11 @@ NotificationCompat.Builder notificationBuilder =
</pre>
<p>You'll also need to extend the {@link
android.support.v4.app.NotificationCompat.Builder} with the
<code>CarExtender</code>. This is where you actually create the
<code>UnreadConversation</code> object using the builder you just
created, and attach it to the <code>CarExtender</code>:</p>
android.support.v4.app.NotificationCompat.Builder} with the {@link
android.support.v4.app.NotificationCompat.CarExtender}. This is where you
actually create the {@link android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation} object using the builder you
just created, and attach it to the {@link
android.support.v4.app.NotificationCompat.CarExtender}:</p>
<pre>
notificationBuilder.extend(new CarExtender()
@ -416,14 +421,11 @@ notificationBuilder.extend(new CarExtender()
android.support.v4.app.NotificationManagerCompat} to send the notification:</p>
<pre>
mNotificationManager = NotificationManagerCompat.from(context);
mNotificationManager.notify(<em>notificationId</em>, notificationBuilder.build());
NotificationManagerCompat msgNotificationManager =
NotificationManagerCompat.from(context);
msgNotificationManager.notify(<em>notificationId</em>, notificationBuilder.build());
</pre>
<p>In this example, <em>msgNotificationManager</em> is a
{@link android.support.v4.app.NotificationManagerCompat} you created for your app.</p>
<h2 id="handle_actions">Handle User Actions</h2>
<p>