docs: Added documentation for Inline action on notification stream and steps...
docs: Added documentation for Inline action on notification stream and steps for adding images to a notification. am: b00d0879
am: 5480deaa
Change-Id: Ibebadfa911fbc1a1624f78a8818de309eb3bb635
@@ -67,7 +67,8 @@ material design</a> visual changes.
We recommended that you don't set color for bridged notifications.
When Wear apps post local notifications, you can work around this by checking
<a href="{@docRoot}training/basics/supporting-devices/platforms.html#version-codes">the API level of the device</a> they're running on and using an appropriate color
<a href="{@docRoot}training/basics/supporting-devices/platforms.html#version-codes">the API level of the device</a>
they're running on and using an appropriate color
for Wear 1.x and a different color for Wear 2.0.
</li>
@@ -77,6 +78,85 @@ material design</a> visual changes.
you must update the text of your notification.
</li>
</ul>
<h2 id="inline">Inline Action</h3>
<img src="{@docRoot}wear/preview/images/inline_action.png" style="float:right;margin:10px 20px 0 0">
<p>
Wear 2.0 now supports inline action, which allows users to take actions on a
notification from within the notification stream card. On Wear, the inline
action appears as an additional button displayed at the bottom of the notification.
</p>
<p>
Inline actions are optional but recommended for cases in which users are likely
to take an action on a notification after viewing the contents in the
Examples of good use cases for inline action on a notification include: replying to a
text message, stopping a fitness activity, and archiving an email message.
</p>
<p>
A notification can provide only one inline action.
To display the inline action as an additional button in the notification, set
the <a href="https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.WearableExtender.html#setHintDisplayActionInline(boolean)">{@code setHintDisplayActionInline()}</a>
method to true. When a user taps the inline action, the system invokes
the intent that you specified in the notification action.
</p>
<h3>Adding an inline action</h3>
<p>
The following code example shows how to create a notification with an inline
Use the <a href="https://developer.android.com/reference/android/support/v4/app/NotificationCompat.Action.Builder.html#addRemoteInput(android.support.v4.app.RemoteInput)">{@code addRemoteInput()}</a>
method to attach the <ahref="https://developer.android.com/reference/android/support/v4/app/RemoteInput.html">{@code RemoteInput}</a>
object to an action.
<pre>
NotificationCompat.Action.Builder actionBuilder = new NotificationCompat.Action.Builder(
which is new in Android 7.0. Wear 2.0 uses the chat messages included in a
{@code MessagingStyle} notification
(see <a href="https://developer.android.com/reference/android/support/v4/app/NotificationCompat.MessagingStyle.html#addMessage(android.support.v4.app.NotificationCompat.MessagingStyle.Message)">{@code addMessage()}</a>)
to provide a rich chat app-like experience in the expanded notification.