diff options
Diffstat (limited to 'docs/html/wear/notifications/remote-input.html')
-rw-r--r-- | docs/html/wear/notifications/remote-input.html | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/docs/html/wear/notifications/remote-input.html b/docs/html/wear/notifications/remote-input.html index 6500233..c8f6621 100644 --- a/docs/html/wear/notifications/remote-input.html +++ b/docs/html/wear/notifications/remote-input.html @@ -373,20 +373,24 @@ onkeyup="return search_changed(event, false, '/')" /> <div class="jd-descr" itemprop="articleBody"> - <img src="/wear/images/13_voicereply.png" height="200" width="169" style="float:right;margin:0 0 20px 60px" /> + <img src="/wear/images/13_voicereply.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" /> <img src="/wear/images/03_actions.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" /> <p>If your notification includes an action to respond with text, such as to reply to an email, it should normally launch an activity - on the handheld device. However, when your notification appears on an Android Wear device, you can + on the handheld device. However, when your notification appears on an Android wearable, you can allow users to dictate a reply with voice input. You can also provide pre-defined text - replies for the user to select.</p> + messages for the user to select.</p> <p>When the user replies with voice or selects one of the available -responses, the system delivers your app on the handheld the -message as a string extra in the <code><a href="/reference/android/content/Intent.html">Intent</a></code> you specified -to be used for the action.</p> +messages, the system sends the message to your app on the connected handheld device. +The message is attached as an extra in the <code><a href="/reference/android/content/Intent.html">Intent</a></code> you specified +to be used for the notification action.</p> + +<p class="note"><strong>Note:</strong> When developing with the Android emulator, +you must type text replies into the voice input field, so be sure you have enabled +<strong>Hardware keyboard present</strong> in the AVD settings.</p> <h2 id="RemoteInput">Define the Remote Input</h2> @@ -397,10 +401,10 @@ to be used for the action.</p> <a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> APIs. The <a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor takes a string that the system - will use as a key for the <code><a href="/reference/android/content/Intent.html">Intent</a></code> extra that caries the reply message + will use as a key for the <code><a href="/reference/android/content/Intent.html">Intent</a></code> extra that carries the reply message to your app on the handheld.</p> -<p>For example, here's a new +<p>For example, here's how to create a new <a href="/reference/android/preview/support/wearable/notifications/RemoteInput.html"> <code>RemoteInput</code></a> object that provides a custom label for the voice input prompt:</p> @@ -422,7 +426,7 @@ RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY) <img src="/wear/images/12_voicereply.png" height="200" style="float:right;margin:0 0 20px 40px" /> <p>In addition to allowing voice input, you can - provide up to five text responses the user can select for quick replies. Call + provide up to five text responses that the user can select for quick replies. Call <a href="/reference/android/preview/support/wearable/notifications/RemoteInput.Builder.html#setChoices(java.lang.String[])"><code>setChoices()</code></a> and pass it a string array.</p> <p>For example, you may define some responses in a resource array:</p> @@ -465,9 +469,9 @@ method), then you should attach the <pre> // Create intent for reply action -Intent replyIntent = new Intent(this, ReplyService.class); +Intent replyIntent = new Intent(this, ReplyActivity.class); PendingIntent replyPendingIntent = - PendingIntent.getService(this, 0, replyIntent, 0); + PendingIntent.getActivity(this, 0, replyIntent, 0); // Build the notification NotificationCompat.Builder replyNotificationBuilder = @@ -563,8 +567,8 @@ Notification replyNotification = .build(); </pre> -<p>Now, when the user selects "Reply" from an Android wearable, - the system prompts for voice input (and provides the list of pre-defined replies, if provided). +<p>Now, when the user selects "Reply" from an Android wearable, the system prompts the user + for voice input (and shows the list of pre-defined replies, if provided). Once the user completes a response, the system invokes the <code><a href="/reference/android/content/Intent.html">Intent</a></code> attached to the action and adds the <code>EXTRA_VOICE_REPLY</code> extra (the string |