diff options
author | Andrew Solovay <asolovay@google.com> | 2014-11-20 01:27:49 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-11-20 01:27:51 +0000 |
commit | 05282133c7491fd2b5e8f3da05408ff0165df526 (patch) | |
tree | 0b98efd42df981570192b1daf74e42e9d855118b /docs | |
parent | 6c43e6b54d7d540e579d2dff8c9cff981cb5ca4a (diff) | |
parent | 9ab79ccd34aa28f8c45652947caca9e0ca67c706 (diff) | |
download | frameworks_base-05282133c7491fd2b5e8f3da05408ff0165df526.zip frameworks_base-05282133c7491fd2b5e8f3da05408ff0165df526.tar.gz frameworks_base-05282133c7491fd2b5e8f3da05408ff0165df526.tar.bz2 |
Merge "docs: Bugfix & minor cleanup for "Providing Messaging for Auto"" into lmp-docs
Diffstat (limited to 'docs')
-rw-r--r-- | docs/html/training/auto/messaging/index.jd | 64 |
1 files changed, 33 insertions, 31 deletions
diff --git a/docs/html/training/auto/messaging/index.jd b/docs/html/training/auto/messaging/index.jd index c51ad7e..2405d83 100644 --- a/docs/html/training/auto/messaging/index.jd +++ b/docs/html/training/auto/messaging/index.jd @@ -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<String> 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> |