am e1beb730: Merge "docs: wear training classes" into klp-modular-dev
* commit 'e1beb730c32348d2a7f194a566eef6e5ed541b3b':
docs: wear training classes
diff --git a/docs/html/training/building-wearables.jd b/docs/html/training/building-wearables.jd
new file mode 100644
index 0000000..4fda10e
--- /dev/null
+++ b/docs/html/training/building-wearables.jd
@@ -0,0 +1,8 @@
+page.title=Building Apps for Wearables
+page.trainingcourse=true
+
+@jd:body
+
+
+<p>These classes teach you how to build notifications in a handheld app that are automatically
+synced to wearables as well as how to build apps that run on wearables.</p>
\ No newline at end of file
diff --git a/docs/html/training/training_toc.cs b/docs/html/training/training_toc.cs
index c5dc3c5..4407d30 100644
--- a/docs/html/training/training_toc.cs
+++ b/docs/html/training/training_toc.cs
@@ -638,7 +638,6 @@
</li>
</ul>
</li>
-
</ul>
</li>
<!-- End connectivity and cloud -->
@@ -727,6 +726,90 @@
<!-- End privacy and location -->
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/building-wearables.html">
+ <span class="small">Building Apps for</span><br/>
+ Wearables
+ </a>
+ </div>
+ <ul>
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/wearables/notifications/index.html"
+ description="How to build handheld notifications that are synced to
+ and look great on wearables."
+ >Adding Wearable Features to Notifications</a>
+ </div>
+ <ul>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/notifications/creating.html">Creating a Notification</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/notifications/voice-input.html">Receiving Voice Input in a Notification</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/notifications/pages.html">Adding Pages to a Notification</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/notifications/stacks.html">Stacking Notifications</a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/wearables/apps/index.html"
+ description="How to build apps that run directly on wearables."
+ >Creating Wearable Apps</a>
+ </div>
+ <ul>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/apps/creating.html">Creating and Running a Wearable App</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/apps/layouts.html">Creating Custom Layouts</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/apps/voice.html">Adding Voice Capabilities</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/apps/packaging.html">Packaging Wearable Apps</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/apps/bt-debugging.html">Debugging over Bluetooth</a>
+ </li>
+ </ul>
+ </li>
+
+ <li class="nav-section">
+ <div class="nav-section-header">
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/index.html"
+ description="How to sync data between handhelds and wearables."
+ >Sending and Syncing Data</a>
+ </div>
+ <ul>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/accessing.html">Accessing the Wearable Data Layer</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/data-items.html">Syncing Data Items</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/assets.html">Transferring Assets</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/messages.html">Sending and Receiving Messages</a>
+ </li>
+ <li>
+ <a href="<?cs var:toroot ?>training/wearables/data-layer/events.html">Handling Data Layer Events</a>
+ </li>
+ </ul>
+ </li>
+ </ul>
+ </li>
+
+ <!-- End Building for wearables -->
<li class="nav-section">
<div class="nav-section-header">
diff --git a/docs/html/training/wearables/apps/bt-debugging.jd b/docs/html/training/wearables/apps/bt-debugging.jd
new file mode 100644
index 0000000..8d09c43
--- /dev/null
+++ b/docs/html/training/wearables/apps/bt-debugging.jd
@@ -0,0 +1,92 @@
+page.title=Debugging over Bluetooth
+
+@jd:body
+
+<div id="tb-wrapper">
+ <div id="tb">
+
+ <!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+ <h2>This lesson teaches you to</h2>
+ <ol>
+ <li><a href="#SetupDevices">Set Up Devices for Debugging</a></li>
+ <li><a href="#SetupSession">Set Up a Debugging Session</a></li>
+ <li><a href="#DebugApp">Debug Your App</a></li>
+ </ol>
+ <h2>You should also read</h2>
+ <ul>
+ <li><a href="{@docRoot}design/wear/index.html">Android Wear Design Principles</a></li>
+ </ul>
+ </div>
+</div>
+
+<p>You can debug your wearable over Bluetooth by routing it's debug output to the
+handheld device that's connected to your development machine.</p>
+
+<h2 id="SetupDevices">Setup Devices for Debugging</h2>
+<ol>
+ <li>Enable USB debugging on the handheld:
+ <ul>
+ <li>Open the Settings app and scroll to the bottom.</li>
+ <li>If it doesn't have a Developer Options setting, tap <b>About Phone</b>
+ (or <b>About Tablet</b>), scroll to the bottom, and tap the build number 7 times.</li>
+ <li>Go back and tap <b>Developer Options</b>.</li>
+ <li>Enable <b>USB debugging</b>.</li>
+ </ul>
+ </li>
+ <li>Enable Bluetooth debugging on the wearable:
+ <ol>
+ <li>Tap the home screen twice to bring up the Wear menu. </li>
+ <li>Scroll to the bottom and tap <b>Settings</b>.</li>
+ <li>Scroll to the bottom. If there's no <b>Developer Options</b> item, tap <b>About</b>,
+ and then tap the build number 7 times.</li>
+ <li>Tap the <b>Developer Options</b> item.</li>
+ <li>Enable <b>Debug over Bluetooth</b>.</li>
+ </ol>
+ </li>
+</ol>
+
+<h2 id="SetupSession">Set Up a Debugging Session</h2>
+<ol>
+ <li>On the handheld, open the Android Wear companion app.</li>
+ <li>Tap the menu on the top right and select <b>Settings</b>.</li>
+ <li>Enable <b>Debugging over Bluetooth</b>. You should see a tiny status summary appear under the
+ option:
+ <pre>
+Host: disconnected
+Target: connected
+</pre>
+</li>
+<li>Connect the handheld to your machine over USB and run:
+<pre>
+adb forward tcp:4444 localabstract:/adb-hub; adb connect localhost:4444
+</pre>
+
+<p class="note"><b>Note</b>: You can use any available port that you have access to.</p>
+</li>
+</ol>
+<p>
+In the Android Wear companion app, you should see the status change to:</p>
+<pre>
+Host: connected
+Target: connected
+</pre>
+
+<h2 id="#debug">Debug Your App</h2>
+
+Your wearable should show up as <code>localhost:4444</code> when running <code>adb devices</code>.
+
+To run any <code>adb</code> command, use this format:
+
+<pre>adb -s localhost:4444 <command> </pre>
+
+<p>If there are no other devices connected over TCP/IP (namely emulators), you can shorten the command
+to:</p>
+<pre>
+adb -e <command>
+</pre>
+<p>For example:</p>
+<pre>
+adb -e logcat
+adb -e shell
+adb -e bugreport
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/apps/creating.jd b/docs/html/training/wearables/apps/creating.jd
new file mode 100644
index 0000000..145aed8
--- /dev/null
+++ b/docs/html/training/wearables/apps/creating.jd
@@ -0,0 +1,184 @@
+page.title=Creating and Running a Wearable App
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#SetupEmulator">Set Up an Android Wear Emulator</a></li>
+ <li><a href="#SetupDevice">Set Up an Android Wear Device</a></li>
+ <li><a href="#CreateProject">Create a Project</a></li>
+ <li><a href="#Libraries">Include the Correct Libraries</a></li>
+</ol>
+<h2>Dependencies and Prerequisites</h2>
+ <ul>
+ <li>Android Studio 0.8 or later and Gradle 1.12 or later</li>
+ </ul>
+</div>
+</div>
+
+<p>Wearable apps run directly on the wearable device, giving you access to low-level
+hardware such as sensors, activities, services, and more, right
+on the wearable.</p>
+
+<p>A companion handheld app that contains the
+wearable app is also required when you want to publish to the Google Play store.
+Wearables don't support the Google Play store, so users download the companion handheld app,
+which automatically pushes the wearable app to the wearable. The handheld app is also
+useful for doing heavy processing, network actions, or other work and
+sending the results to the wearable.
+</p>
+
+<p>This lesson goes over how to set up a device or emulator and create one project to contain
+both your wearable and handheld apps.
+</p>
+
+
+<h2 id="SetupEmulator">Set Up an Android Wear Emulator or Device</h2>
+<p>We recommend that you develop on real hardware so you can better
+gauge the user experience. However, the emulator lets you test out different
+types of screen shapes, which is useful for testing.</p>
+
+<h3>Set up an Android Wear Virtual Device</h3>
+
+<p>To set up an Android Wear virtual device:</p>
+<ol>
+ <li>Click <b>Tools > Android > AVD Manager</b>.</li>
+ <li>Click <b>Create...</b>.</li>
+ <li>Fill in the following details for the AVD you want to specify and leave the rest
+ of the fields with their default values:
+ <ol>
+ <li><b>AVD Name</b> - A name for your AVD</li>
+ <li><b>Device</b> - Android Wear Round or Square device types</li>
+ <li><b>Target</b> - Android 4.4W - API Level 20</li>
+ <li><b>CPU/ABI</b> - Android Wear ARM (armeabi-v7a)</li>
+ <li><b>Keyboard</b> - Select <b>Hardware keyboard present</b></li>
+ <li><b>Skin</b> - AndroidWearRound or AndroidWearSquare depending on the selected device type</li>
+ <li><b>Snapshot</b> - Not selected</li>
+ <li><b>Use Host GPU</b> - Selected, to support custom activities for wearable notifications</li>
+ </ol>
+ </li>
+ <li>Click <b>OK</b>.</li>
+<li>Start the emulator:
+<ol>
+ <li>Select the virtual device you just created.</li>
+ <li>Click <b>Start...</b>, then click <b>Launch</b>.</li>
+ <li>Wait until the emulator initializes and shows the Android Wear home screen.</li>
+</ol>
+</li>
+<li>Pair Your handheld with the emulator:
+<ol>
+ <li>On your handheld, install the Android Wear app from Google Play.</li>
+ <li>Connect the handheld to your machine through USB.</li>
+ <li>Forward the AVD's communication port to the connected handheld device (you must
+ do this every time the handheld is connected):
+ <pre>adb -d forward tcp:5601 tcp:5601</pre>
+ </li>
+ <li>Start the Android Wear app on your handheld device and connect to the emulator.</li>
+ <li>Tap the menu on the top right corner of the Android Wear app and select
+ <b>Demo Cards</b>.</li>
+ <li>The cards you select appear as notifications on the home screen of the emulator.</li>
+</ol>
+</li>
+</ol>
+
+<h3 id="SetupDevice">Set Up an Android Wear Device</h3>
+<p>To set up an Android Wear device:</p>
+<ol>
+ <li>Install the Android Wear app, available on Google Play, on your handheld.</li>
+ <li>Follow the app's instructions to pair your handheld with your wearable.
+ This allows you to test out synced handheld notifications, if you're building them.</li>
+ <li>Connect the wearable to your machine through USB, so you can install apps directly to it
+ as you develop.</li>
+</ol>
+
+<h2 id="CreateProject">Create a Project</h2>
+
+<p>To begin development, create an app project that contains
+ wearable and handheld app modules. In Android Studio, click <b>File</b> >
+ <b>New Project</b> and follow the Project Wizard instructions, as described in
+ <a href="{@docRoot}sdk/installing/create-project.html">Creating a
+Project</a>. As you follow the wizard, enter the following information:</p>
+
+<ol>
+ <li>In the <b>Configure your Project</b> window, enter a name for your app and a package
+ name.</li>
+ <li>In the <b>Form Factors</b> window:
+ <ul>
+ <li>Select <b>Phone and Tablet</b> and select <b>API 8: Android 2.2 (Froyo)</b>
+ under <b>Minimum SDK</b>.</li>
+ <li>Select <b>Wear</b> and select <b>API 20: Android 4.4 (KitKat Wear)</b>
+ under <b>Minimum SDK</b>.</li>
+ </ul>
+ </li>
+ <li>In the first <b>Add an Activity</b> window, add a blank activity for mobile.</li>
+ <li>In the second <b>Add an Activity</b> window, add a blank activity for Wear.
+
+ <p>When the wizard completes, Android Studio creates a new project with two modules, <b>mobile</b> and
+ <b>wear</b>. You now have a project for both your handheld and wearable apps that you can create activities,
+ services, custom layouts, and much more in. On the handheld app, you do most of the heavy lifting,
+ such as network communications, intensive processing, or tasks that require long
+ amounts of user interaction. When these are done,
+ you usually notify the wearable of the results through notifications or by syncing and sending
+ data to the wearable.</p>
+
+ <p class="note"><b>Note:</b> The <b>wear</b> module also contains a "Hello World" activity that uses a
+ <code>WatchViewStub</code> that inflates a layout based on whether the device's screen
+ is round or square. The <code>WatchViewStub</code> class is one of the UI widgets that's provided
+ by the <a href="{@docRoot}training/wearables/apps/layouts#UiLibrary">wearable support library</a>.</p>
+</li>
+
+<h2 id="Install">Install the Wearable app</h2>
+
+<p>When developing, you install apps directly to the wearable like with handheld apps. Use
+either <code>adb install</code> or the <b>Play</b> button on Android Studio.</p>
+
+<p>When you're ready to publish your app to users, you embed the wearable app inside of the
+handheld app. When users install the handheld app from Google Play, a connected wearable automatically
+receives the wearable app.</p>
+
+<p class="note"><b>Note:</b> The automatic installation of wearable apps
+does not work when you are signing apps with a debug key and only works with release keys. See
+<a href="{@docRoot}traiing/wearables/packaging.html">Packaging Wearable Apps</a> for
+complete information on how to properly package wearable apps.</p>
+
+<li>
+To install the "Hello World" app to the wearable, select <b>wear</b> from the <b>Run/Debug
+configuration</b> drop-down menu and click the <b>Play</b> button. The activity shows up on the
+wearable and prints out "Hello world!"
+</li></ol>
+<h2 id="Libraries">Include the Correct Libraries</h2>
+
+<p>As part of the Project Wizard, the correct
+dependencies are imported for you in the appropriate module's <code>build.gradle</code> file.
+However, these dependencies are not required, so read the following descriptions to find out if you need them or not:</p>
+
+<b>Notifications</b>
+<p>The <a href="{@docRoot}tools/support-library/features.html#v4">The
+Android v4 support library</a> (or v13, which includes v4)
+contains the APIs to extend your existing notifications on handhelds to support wearables.</p>
+
+<p>For notifications that appear only on
+the wearable (meaning, they are issued by an app that runs on the wearable), you can just use the
+standard framework APIs (API Level 20) on the wearable and remove the support library
+dependency in the <b>mobile</b> module of your project.
+</p>
+
+<b>Wearable Data Layer</b>
+<p>To sync and send data between wearables and handhelds with the Wearable Data Layer APIs,
+you need the latest version of
+<a href="{@docRoot}google/play-services/setup.html">Google Play services</a>.
+If you're not using these APIs, remove the dependency from both modules.</p>
+
+<b>Wearable UI support library</b>
+<p>This is an unofficial library that includes UI widgets designed for wearables. We encourage you
+to use them in your apps, because they exemplify best practices, but they can still
+change at any time. However, if the libraries are updated, your apps won't break since they are compiled
+into your app. To get new features from an updated library, you just need to
+statically link the new version and update your app accordingly.
+This library is only applicable if you create wearable apps.
+</p>
+
+<p>In the next lessons, you'll learn how to create layouts designed for wearables as well as how
+to use the various voice actions that are supported by the platform.</p>
diff --git a/docs/html/training/wearables/apps/index.jd b/docs/html/training/wearables/apps/index.jd
new file mode 100644
index 0000000..c2c7f39
--- /dev/null
+++ b/docs/html/training/wearables/apps/index.jd
@@ -0,0 +1,72 @@
+page.title=Creating Wearable Apps
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+ <h2>Dependencies and Prerequisites</h2>
+ <ul>
+ <li>Android Studio 0.8 or later and Gradle 1.12 or later</li>
+ </ul>
+</div>
+</div>
+
+<p>
+Wearable apps run directly on the device, giving you access to hardware such as sensors and the
+GPU. They are fundamentally the same as apps built for other devices using the Android SDK, but
+differ greatly in design and usability and the amount of functionality provided.
+These are the main differences between handheld and wearable apps:</p>
+
+<ul>
+ <li>The system enforces a timeout period. If you are displaying an activity and user's don't
+ interact with it, the device sleeps. When it wakes back up, the Wear home screen is displayed
+ instead of your activity. If you need to show something persistent, create a notification in the
+ context stream instead.</li>
+ <li>Wearable apps are relatively small in size and functionality compared to handheld apps.
+ They contain only what makes sense on the wearable, which is usually a small
+ subset of the corresponding handheld app. In general, you should carry out operations on the
+ handheld when possible and send the results to the wearable.
+ </li>
+ <li>Users don't download apps directly onto the wearable. Instead, you bundle
+ the wearable app inside the handheld app. When users install the handheld app,
+ the system automatically installs the wearable app. However, for development
+ purposes, you can still install the wearable app directly to the wearable.</li>
+ <li><p>Wearable apps can access much of the standard Android APIs, but don't support
+ the following APIs:</p>
+ <ul>
+ <li>{@link android.webkit}</li>
+ <li>{@link android.print}</li>
+ <li>{@link android.app.backup}</li>
+ <li>{@link android.appwidget}</li>
+ <li>{@link android.hardware.usb}</li>
+ </ul>
+ <p>
+ You can check if a wearable supports a feature by calling
+ {@link android.content.pm.PackageManager#hasSystemFeature hasSystemFeature()}
+ before trying to use an API.</p>
+</li>
+</ul>
+
+<p class="note"><b>Note:</b> We recommend using Android Studio for Android Wear development
+as it provides project setup, library inclusion, and packaging conveniences that aren't available
+in ADT. The rest of this training assumes you're using Android Studio.
+</p>
+
+<h2>Lessons</h2>
+ <dl>
+ <dt><a href="{@docRoot}training/wearables/apps/creating.html">Creating and Running a Wearable App</a></dt>
+ <dd>Learn how to create an Android Studio project that
+ contains both the wearable and handheld app modules and how to run the app on a device
+ or emulator.</dd>
+ <dt><a href="{@docRoot}training/wearables/apps/activity.html">Creating Custom Layouts</a></dt>
+ <dd>Learn how to create and display custom layouts for notifications and
+ activities.</dd>
+ <dt><a href="{@docRoot}training/wearables/apps/voice.html">Adding Voice Capabilities</a></dt>
+ <dd>Learn how to launch an activity with a voice actions and how to start the
+ system speech recognizer app to obtain free-form voice input.</dd>
+ <dt><a href="{@docRoot}training/wearables/apps/packaging.html">Packaging Wearable Apps</a></dt>
+ <dd>Learn how to package a wearable app inside a
+ handheld app. This allows the system to install the wearable app automatically when
+ users install the companion handheld app from the Google Play store.</dd>
+ <dt><a href="{@docRoot}training/wearables/apps/packaging.html">Debugging over Bluetooth</a></dt>
+ <dd>Learn how to debug your wearable over Bluetooth instead of USB.</dd>
+ </dl>
\ No newline at end of file
diff --git a/docs/html/training/wearables/apps/layouts.jd b/docs/html/training/wearables/apps/layouts.jd
new file mode 100644
index 0000000..983c359
--- /dev/null
+++ b/docs/html/training/wearables/apps/layouts.jd
@@ -0,0 +1,131 @@
+page.title=Creating Custom Layouts
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#CustomNotifications">Create custom notifications</a></li>
+ <li><a href="#UiLibrary">Create Layouts with the Wearable UI Library</li>
+</ol>
+
+<!--STOPSHIP: link these -->
+<h2>You should also read</h2>
+<ul>
+ <li><a href="{@docRoot}design/wear/index.html">Android Wear Design Principles</a></li>
+</ul>
+
+</div>
+</div>
+
+<p>Creating layouts for wearables is the same as handheld devices, except you have to design
+for the screen size and for glanceability. Do not port functionality
+and the UI from a handheld app and expect a good experience. You should create custom layouts
+only when necessary. Read the <a href="{@docRoot}design/wear/index.html">design guidelines</a>
+for information on how to design great wearable apps.</p>
+
+<h2 id="CustomNotifications">Create Custom Notifications</h2>
+
+<p>
+In general, you should create notifications on the handheld and let them
+automatically sync to the wearable. This lets you build your notifications
+once and have them appear on many types of devices (not just wearables, but
+eventually Auto and TV) without having to design them for different
+form factors.</p>
+
+<p>If the standard notification styles don't work for you (such as
+{@link android.support.v4.app.NotificationCompat.BigTextStyle} or
+{@link android.support.v4.app.NotificationCompat.InboxStyle}), you can display an activity with
+a custom layout. You can only create and issue custom notifications on the wearable, and the
+system does not sync these notifications to the handheld.</p>
+
+<p clas="note"><b>Note:</b> When creating custom notifications on the wearable, you can use the
+standard notification APIs (API Level 20) instead of the Support Library.
+</p>
+
+<p>To create a custom notification:</p>
+<ol>
+ <li>Create a layout and set it as the content view for the activity
+ that you want to display.
+<pre>
+public void onCreate(Bundle bundle){
+ ...
+ setContentView(R.layout.notification_activity);
+}
+</pre>
+ </li>
+ <li>Set the activity's <code>allowEmbedded</code> property to <code>true</code>
+ in the wearable app's Android manifest. This allows an activity that you create in your wearable
+ app to be displayed by the wearable's context stream process.</li>
+<pre>
+<activity android:allowEmbedded="true" ... >
+...
+</activity>
+</pre>
+ </li>
+ <li>Create a {@link android.app.PendingIntent} for the activity that you want to display.
+ For example:
+<pre>
+Intent notificationIntent = new Intent(this, NotificationActivity.class);
+PendingIntent notificationPendingIntent = PendingIntent.getActivity(this, 0, notificationIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT);
+</pre>
+ </li>
+ <li>Build a {@link android.app.Notification} and call
+ {@link android.app.Notification.WearableExtender#setDisplayIntent setDisplayIntent()}
+ providing the {@link android.app.PendingIntent}. The system uses this
+ {@link android.app.PendingIntent} to launch the activity when
+ users view your notification.
+ </li>
+ <li>Issue the notification using the
+ {@link android.app.NotificationManager#notify notify()} method.
+ <p class="note"><b>Note:</b> The system initially displays your notification with
+ a standard template. This template works well on all watchfaces. When users swipe the notification
+ up to view it, they'll then see your activity for the notification.</p>
+ </li>
+</ol>
+<h2 id="UiLibrary">Create Layouts with the Wearable UI Library</h2>
+<p>
+There's an unofficial UI library that is automatically included when you create your wearable
+app with the Android Studio Project Wizard. You can also add the library to your <code>build.gradle</code>
+file with the following dependency declaration:
+
+<pre>
+dependencies {
+ compile fileTree(dir: 'libs', include: ['*.jar'])
+ <b>compile 'com.google.android.support:wearable:+'</b>
+ compile 'com.google.android.gms:play-services-wearable:+'
+}
+</pre>
+This library helps you build UIs that are designed for wearables. Here are some of the major classes:
+</p>
+
+<ul>
+ <li><code>BoxInsetLayout</code> - A FrameLayout that's aware of screen shape and can box its
+ children in the center square of a round screen.</li>
+ <li><code>CardFragment</code> - A fragment that presents content within an expandable,
+ vertically scrollable card.</li>
+ <li><code>CircledImageView</code> - An image view surrounded by a circle.</li>
+ <li><code>ConfirmationActivity</code> - An activity that displays confirmation animations after the user
+ completes an action.</li>
+ <li><code>DismissOverlayView</code> - A view for implementing long-press-to-dismiss.</li>
+ <li><code>GridViewPager</code> - A layout manager that allows the user to both vertically and
+ horizontally through pages of data. You supply an implementation of a GridPagerAdapter to
+ generate the pages that the view shows.</li>
+ <li><code>GridPagerAdapter</code> - An adapter that supplies pages to a GridViewPager.</li>
+ <li><code>FragmentGridPagerAdapter</code> - An implementation of GridPagerAdapter that
+ represents each page as a fragment.</li>
+ </li>
+ <li><code>WatchViewStub</code> - A class that can inflate a specific layout,
+ depending on the shape of the device's screen.</li>
+ <li><code>WearableListView</code> - An alternative version of ListView that is optimized for
+ ease of use on small screen wearable devices. It displays a vertically scrollable list of items,
+ and automatically snaps to the nearest item when the user stops scrolling.
+ </li>
+</ul>
+
+<p class="note"><a href="{@docRoot}shareables/training/wearable-support-docs.zip">Download the full API
+reference documentation</a> for the classes above. The documentation goes over how to use
+each UI widget.</p>
diff --git a/docs/html/training/wearables/apps/packaging.jd b/docs/html/training/wearables/apps/packaging.jd
new file mode 100644
index 0000000..ea29c9d
--- /dev/null
+++ b/docs/html/training/wearables/apps/packaging.jd
@@ -0,0 +1,156 @@
+page.title=Packaging Wearable Apps
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#Studio">Package with Android Studio</a></li>
+ <li><a href="#PackageManually">Package Manually</a></li>
+ <li><a href="#AssetCompression">Turn off Asset Compression</a></li>
+</ol>
+</div>
+</div>
+
+<p>When publishing to users, you must package a wearable app inside of a handheld app,
+because users cannot browse and install apps directly on the wearable. If packaged properly,
+when users download the handheld app, the system automatically pushes the wearable app to the
+paired wearable.
+</p>
+
+<p class="note"><b>Note:</b> This feature doesn't work when you are signing your apps with
+a debug key when developing. While developing, installing apps with <code>adb install</code> or
+Android Studio directly to the wearable is required.</p>
+
+
+<h2 id="Studio">Package with Android Studio</h2>
+<p>To properly package a wearable app in Android Studio:</p>
+
+<ol>
+ <li>Declare a Gradle dependency in the handheld app's <code>build.gradle</code> file
+ that points to the wearable app module:
+<pre>
+dependencies {
+ compile 'com.google.android.gms:play-services:5.0.+@aar'
+ compile files('../../prebuilt-libs/android-support-v4.jar')
+ <b>wearApp project(':wearable')</b>
+}
+</pre>
+ </li>
+ <li>Click <b>Build > Generate Signed APK...</b> and follow the on-screen instructions
+ to specify your release keystore and sign your app. Android Studio exports the signed
+ handheld app with the wearable app embedded in it automatically into your project's root folder.
+
+ <p>Alternatively, you can create a <code>signingConfig</code> rule in the wearable and handheld
+ modules' <code>build.gradle</code> file to sign them with your release key. Both apps must be
+ signed to have the automatic pushing of the wearable app work.
+
+<pre>
+android {
+ ...
+ signingConfigs {
+ release {
+ keyAlias 'myAlias'
+ keyPassword 'myPw'
+ storeFile file('path/to/release.keystore')
+ storePassword 'myPw'
+ }
+ }
+ buildTypes {
+ release {
+ ...
+ signingConfig signingConfigs.release
+ }d
+ }
+ ...
+}
+</pre>
+ <p>Build the handheld app by clicking the Gradle button on the right vertical toolbar of
+ Android Studio and running the <b>assembleRelease</b> task. The task is located under
+ <b>Project name > Handheld module name > assembleRelease</b>.
+ </p>
+
+<p class="note"><b>Note:</b>This example embeds the password in your Gradle file, which might be undesirable. See
+<a href="{@docRoot}sdk/installing/studio-build.html#configureSigning">Configure signing settings</a>
+for information about how to create an environment variable for the passwords instead.
+</p>
+</ol>
+
+
+<h3>Signing the wearable and handheld app separately</h3>
+<p>If your build process requires signing the wearable app separately from the handheld app,
+you can declare the following Gradle rule in the handheld module's <code>build.gradle</code> to
+embed the previously-signed wearable app:</p>
+
+<pre>
+dependencies {
+ ...
+ wearApp files('/path/to/wearable_app.apk')
+}
+</pre>
+
+<p>You then sign your handheld app in any manner you wish (either with the Android Studio
+<b>Build > Generate Signed APK...</b> menu item or with Gradle <code>signingConfig</code> rules as
+described in the previous section.</p>
+
+<h2 id="PackageManually">Package Manually</h2>
+<p>
+It's still possible to package the wearable app into the handheld app manually
+if you are using another IDE or another method of building.
+</p>
+
+<ol>
+ <li>Copy the signed wearable app into your handheld project's <code>assets/</code> directory,
+ referred to as <code>path/to/wearable_app.apk</code>.</li>
+ <li>Create a <code>res/xml/wearable_app_desc.xml</code> file that contains the version and
+ path information of the wearable app:
+<pre>
+<wearableApp package="com.google.android.wearable.myapp">
+ <versionCode>1</versionCode>
+ <versionName>1.0</versionName>
+ <path>path/to/wearable_app.apk</path>
+</wearableApp>
+</pre>
+<p>
+The <code>package</code>, <code>versionCode</code>, and <code>versionName</code> are the
+same as values specified in the wearable app's <code>AndroidManifest.xml</code> file.
+The path is the full path of <code>wearable_app.apk</code>, relative to the <code>assets/</code>
+directory.
+</p>
+</li>
+<li>
+Add a <code>meta-data</code> tag to your handheld app's <code><application></code> tag to
+reference the <code>wearable_app_desc.xml</code> file.
+<pre>
+ <meta-data android:name="com.google.android.wearable.myapp"
+ android:resource="@xml/wearable_app_desc"/>
+</pre>
+</li>
+<li>Build and sign the handheld app.</li>
+</ol>
+
+<h2 id="AssetCompression">Turn off Asset Compression</h2>
+<p>
+Many build tools automatically compress any files added to the <code>assets/</code>
+directory of an Android app. Because the wearable APK is already zipped, these tools re-compress the
+wearable APK and the wearable app installer can no longer read the wearable app.
+</p>
+
+<p> When this happens, the installation fails. On the handheld app, the <code>PackageUpdateService</code>
+logs the following error: "this file cannot be opened as a file descriptor; it is probably compressed."
+
+<p> To prevent this error in Android Studio, update your handheld app's <code>build.gradle</code> file
+with the following declaration:
+</p>
+
+<pre>
+android {
+ aaptOptions {
+ noCompress "apk"
+ }
+}
+</pre>
+
+<p>If you are using another build process, ensure that you don't doubly compress the wearable app.</p>
\ No newline at end of file
diff --git a/docs/html/training/wearables/apps/voice.jd b/docs/html/training/wearables/apps/voice.jd
new file mode 100644
index 0000000..3dea5d7
--- /dev/null
+++ b/docs/html/training/wearables/apps/voice.jd
@@ -0,0 +1,274 @@
+page.title=Adding Voice Capabilities
+@jd:body
+
+<div id="tb-wrapper">
+ <div id="tb">
+
+ <!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+ <h2>This lesson teaches you to</h2>
+ <ol>
+ <li><a href="#SystemProvided">Declare System-provided Voice Actions</a></li>
+ <li><a href="#AppProvided">Declare App-provided Voice Actions</a></li>
+ <li><a href="#FreeFormSpeech">Obtaining Free-form Speech Input</a></li>
+ </ol>
+ <h2>You should also read</h2>
+ <ul>
+ <li><a href="{@docRoot}design/wear/index.html">Android Wear Design Principles</a></li>
+ </ul>
+ </div>
+</div>
+
+<p>Voice actions are an important part of the wearable experience. They let users carry
+out actions hands-free and quickly. Wear provides two types of voice actions:</p>
+
+<dl>
+ <dt><b>System-provided</b></dt>
+ <dd>These voice actions are task-based and are built
+ into the Wear platform. You filter for them in the activity that you want to start when the
+ voice action is spoken. Examples include "Take a note" or "Set an alarm".</dd>
+ <dt><b>App-provided</b></dt>
+ <dd>These voice actions are app-based, and you declare them just like a launcher icon.
+ Users say "Start <Your App Name>" to use these voice actions and an activity that you specify
+ starts.</dd>
+</dl>
+
+<h2 id="SystemProvided" style="clear:right">Declare System-provided Voice Actions</h2>
+<p>
+The Android Wear platform provides several voice intents that are based on user actions such
+as "Take a note" or "Set an alarm". This allows users to say what they want to do and let
+the system figure out the best activity to start.</p>
+
+<p>When users speak the voice action, your app can filter for the intent that is fired to start
+an activity. If you want to start a service to do something in the background, show an activity as
+a visual cue and start the service in the activity. Make sure to call
+{@link android.app.Activity#finish finish()} when you want to get rid of the visual cue.
+</p>
+
+<p>For example, for the "Take a note" command, declare this intent filter to start an activity
+named <code>MyNoteActivity</code>:
+</p>
+
+<pre>
+ <activity android:name="MyNoteActivity">
+ <intent-filter>
+ <action android:name="android.intent.action.SEND" />
+ <category android:name="com.google.android.voicesearch.SELF_NOTE" />
+ </intent-filter>
+ </activity>
+</pre>
+
+<p>Here is a list of the voice intents supported by the Wear platform:</p>
+
+<table>
+ <tr>
+ <th>Name</th>
+ <th>Example Phrases</th>
+ <th>Intent</th>
+ </tr>
+
+ <tr>
+ <td>Call a car/taxi</td>
+ <td>"OK Google, get me a taxi"<br/><br/>"OK Google, call me a car"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd>
+ <code>com.google.android.gms.actions.RESERVE_TAXI_RESERVATION</code>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Take a note</td>
+ <td>"OK Google, take a note"<br/><br/>"OK Google, note to self"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>android.intent.action.SEND</code></dd>
+ <dt>Category</dt>
+ <dd><code>com.google.android.voicesearch.SELF_NOTE</code></dd>
+ <dt>Extras</dt>
+ <dd><code>android.content.Intent.EXTRA_TEXT</code> - a string with note body</dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Set alarm</td>
+ <td>"OK Google, set an alarm for 8 AM"<br/><br/>"OK Google, wake me up at 6 tomorrow"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>android.intent.action.SET_ALARM</code></dd>
+ <dt>Extras</dt>
+ <dd><code>android.provider.AlarmClock.EXTRA_HOUR</code> - an integer with the hour of
+ the alarm.
+ <p><code>android.provider.AlarmClock.EXTRA_MINUTES</code> -
+ an integer with the minute of the alarm
+ <p>(these 2 extras are optional, either none or
+ both are provided)</p></dd>
+
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Set timer</td>
+ <td>"Ok Google, set a timer for 10 minutes"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>android.provider.AlarmClock.ACTION_SET_TIMER</code></dd>
+ <dt>Extras</dt>
+ <dd><code>android.provider.AlarmClock.EXTRA_LENGTH</code> - an integer in the range of
+ 1 to 86400 (number of seconds in 24 hours) representing the length of the timer </dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Start/Stop a bike ride</td>
+ <td>"OK Google, start cycling"<br/><br/>"OK Google, start my bike ride"<br/><br/>"OK Google, stop cycling"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>vnd.google.fitness.TRACK</code></dd>
+ <dt>Mime Type</dt>
+ <dd><code>vnd.google.fitness.activity/biking</code></dd>
+ <dt>Extras</dt>
+ <dd><code>actionStatus</code> - a string with the value <code>ActiveActionStatus</code>
+ when starting and <code>CompletedActionStatus</code> when stopping.</dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Start/Stop a run</td>
+ <td>"OK Google, track my run"<br/><br/>"OK Google, start running"<br/><br/>"OK Google, stop running"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>vnd.google.fitness.TRACK</code></dd>
+ <dt>MimeType</dt>
+ <dd><code>vnd.google.fitness.activity/running</code></dd>
+ <dt>Extras</dt>
+ <dd><code>actionStatus</code> - a string with the value <code>ActiveActionStatus</code>
+ when starting and <code>CompletedActionStatus</code> when stopping</dd>
+ </dl>
+ </td>
+ </tr>
+
+
+ <tr>
+ <td>Start/Stop a workout</td>
+ <td>"OK Google, start a workout"<br/><br/>"OK Google, track my workout"<br/><br/>"OK Google, stop workout"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>vnd.google.fitness.TRACK</code></dd>
+ <dt>MimeType</dt>
+ <dd><code>vnd.google.fitness.activity/other</code></dd>
+ <dt>Extras</dt>
+ <dd><code>actionStatus</code> - a string with the value <code>ActiveActionStatus</code>
+ when starting and <code>CompletedActionStatus</code> when stopping</dd>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Show heart rate</td>
+ <td>"OK Google, what’s my heart rate?"<br/><br/>"OK Google, what’s my bpm?"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>vnd.google.fitness.VIEW</code></dd>
+ <dt>Mime Type</dt>
+ <dd><code>vnd.google.fitness.data_type/com.google.heart_rate.bpm</code></dd>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+
+ <tr>
+ <td>Show step count</td>
+ <td>"OK Google, how many steps have I taken?"<br/><br/>"OK Google, what’s my step count?"</td>
+ <td>
+ <dl>
+ <dt>Action</dt>
+ <dd><code>vnd.google.fitness.VIEW</code></dd>
+ <dt>Mime Type</dt>
+ <dd><code>vnd.google.fitness.data_type/com.google.step_count.cumulative</code></dd>
+ </dd>
+ </dl>
+ </td>
+ </tr>
+
+</table>
+
+<p>
+For documentation on registering for platform intents and accessing the extras information
+contained in them, see <a href="{@docRoot}guide/components/intents-common.html">Common intents</a>.
+</p>
+
+<h2 id="AppProvided">Declare App-provided Voice Actions</h2>
+<p>
+If none of the platform voice intents work for you, you can start your apps directly with
+a "Start MyActivityName" voice action. </p>
+
+<p>Registering for a "Start" action is the same as registering
+for a launcher icon on a handheld. Instead of requesting an app icon in a launcher,
+your app requests a voice action instead.</p>
+
+<p>To specify the text to say after "Start", specify a <code>label</code> attribute for the activtiy
+that you want to start. For example, this intent filter recognizes the
+"Start MyRunningApp" voice action and launches <code>StartRunActivity</code>.
+</p>
+
+<pre>
+<application>
+ <activity android:name="StartRunActivity" android:label="MyRunningApp">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+</application>
+</pre>
+
+<h2 id="FreeFormSpeech">Obtaining Free-form Speech Input</h2>
+<p>In addition to using voice actions to launch activities, you can also call the system's
+built-in Speech Recognizer activity to obtain speech input from users. This is useful to obtain input
+from users and then process it, such as doing a search or sending it as a message.</p>
+
+In your app, you call {@link android.app.Activity#startActivityForResult startActivityForResult()} using
+the {@link android.speech.RecognizerIntent#ACTION_RECOGNIZE_SPEECH} action. This starts the
+ and then handle the result
+in {@link android.app.Activity#onActivityResult onActivityResult()}.
+<pre>
+private static final int SPEECH_REQUEST_CODE = 0;
+
+// Create an intent that can start the Speech Recognizer activity
+private void displaySpeechRecognizer() {
+ Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);
+ intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL,
+ RecognizerIntent.LANGUAGE_MODEL_FREE_FORM);
+// Start the activity, the intent will be populated with the speech text
+ startActivityForResult(intent, SPEECH_REQUEST_CODE);
+}
+
+// This callback is invoked when the Speech Recognizer returns.
+// This is where you process the intent and extract the speech text from the intent.
+@Override
+protected void onActivityResult(int requestCode, int resultCode,
+ Intent data) {
+ if (requestCode == SPEECH_REQUEST && resultCode == RESULT_OK) {
+ List<String> results = data.getStringArrayListExtra(
+ RecognizerIntent.EXTRA_RESULTS);
+ String spokenText = results.get(0);
+ // Do something with spokenText
+ }
+ super.onActivityResult(requestCode, resultCode, data);
+}
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/data-layer/accessing.jd b/docs/html/training/wearables/data-layer/accessing.jd
new file mode 100644
index 0000000..4babd0a
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/accessing.jd
@@ -0,0 +1,59 @@
+page.title=Accessing the Wearable Data Layer
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li>Set up a Google Play services client to use the Wearable Data Layer APIs</li>
+</ol>
+
+<h2>Dependencies and Prerequisites</h2>
+<ol>
+ <li><a href="{@docRoot}training/wearables/apps/environment.html">Creating
+ Wearable Apps > Setting up Your Environment</a></li>
+ <li><a href="{@docRoot}training/wearables/apps/creating.html">Creating
+ Wearable Apps > Creating a Project</a></li>
+</ol>
+</div>
+</div>
+
+<p>To call the data layer API, create an instance of
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a>,
+the main entry point for any of the Google Play services APIs.
+</p>
+
+<p>
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a>
+provides a builder that makes it easy to create an instance of the client.
+A minimal <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a> looks like this:
+</p>
+
+<p class="note"><b>Note:</b> For now, this minimal client is enough to get started. However, see
+<a href="{@docRoot}google/auth/api-client.html">Accessing Google Play services APIs</a>
+for more information about creating a<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a>,
+implementing its callbacks, and handling error cases.</p>
+
+<pre style="clear:right">
+GoogleApiClient mGoogleAppiClient = new GoogleApiClient.Builder(this)
+ .addConnectionCallbacks(new ConnectionCallbacks() {
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ Log.d(TAG, "onConnected: " + connectionHint);
+ }
+ @Override
+ public void onConnectionSuspended(int cause) {
+ Log.d(TAG, "onConnectionSuspended: " + cause);
+ }
+ })
+ .addOnConnectionFailedListener(new OnConnectionFailedListener() {
+ @Override
+ public void onConnectionFailed(ConnectionResult result) {
+ Log.d(TAG, "onConnectionFailed: " + result);
+ }
+ })
+ .addApi(Wearable.API)
+ .build();
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/data-layer/assets.jd b/docs/html/training/wearables/data-layer/assets.jd
new file mode 100644
index 0000000..73ebb73
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/assets.jd
@@ -0,0 +1,123 @@
+page.title=Transferring Assets
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#TransferAsset">Transfer an Asset</a></li>
+ <li><a href="#ReceiveAsset">Receive an Asset</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>
+To send large blobs of binary data over the Bluetooth transport, such as images, attach an
+<a href="{@docRoot}reference/com/google/android/gms/wearable/Asset.html">Asset</a> to a
+data item and the put the data item into the replicated data store.
+</p>
+
+<p>Assets automatically handle caching of data to prevent retransmission and conserve Bluetooth bandwidth.
+A common pattern is for a handheld app to download an image, shrink it to an appropriate size
+for display on the wearable, and transmit it to the wearable app as an Asset. The following examples
+demonstrates this pattern.
+</p>
+
+<p class="note"><b>Note:</b> Although the size of data items are limited to 100KB,
+assets can be as large as desired. However, transferring large assets affect the
+user experience in many cases, so test your apps to ensure that they perform well
+if you're transferring large assets.
+<p>
+
+<h2 id="TransferAsset">Transfer an Asset</h2>
+<p>Create the asset using one of the <code>create...()</code> methods in the
+<a href="{@docRoot}reference/com/google/android/gms/wearable/Asset.html"><code>Asset</code></a> class.
+Here, we convert a bitmap to a byte stream and then call
+<a href="{@docRoot}reference/com/google/android/gms/wearable/Asset.html#createFromBytes(byte[])"><code>createFromBytes()</code></a>
+to create the asset.
+</p>
+
+<pre>
+private static Asset createAssetFromBitmap(Bitmap bitmap) {
+ final ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, byteStream);
+ return Asset.createFromBytes(byteStream.toByteArray());
+}
+</pre>
+
+<p>When you have an asset, attach it to a data item with the <code>putAsset()</code> method in
+
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html"><code>DataMap</code></a>
+or
+<a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html"><code>PutDataRequest</code></a>
+and then put the data item into the data store with
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#putDataItem(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.PutDataRequest)"><code>putDataItem()</code></a>:
+</p>
+
+<p><b>Using PutDataRequest</b></p>
+<pre>
+Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image);
+Asset asset = createAssetFromBitmap(bitmap);
+PutDataRequest request = PutDataRequest.create("/image");
+request.putAsset("profileImage", asset);
+Wearable.DataApi.putDataItem(mGoogleApiClient, request);
+</pre>
+
+<p><b>Using PutDataMapRequest</b></p>
+<pre>
+Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.image);
+Asset asset = createAssetFromBitmap(bitmap);
+PutDataMapRequest dataMap = PutDataMapRequest.create("/image");
+dataMap.getDataMap().putAsset("profileImage", asset)
+PutDataRequest request = dataMap.asPutDataRequest();
+PendingResult<DataApi.DataItemResult> pendingResult = Wearable.DataApi
+ .putDataItem(mGoogleApiClient, request);
+</pre>
+
+<h2 id="ReceiveAsset">Receive assets</h2>
+
+<p>
+When an asset is created, you probably want to read and extract
+it on other side of the connection. Here's an example of how to implement the
+callback to detect an asset change and extract the Asset:
+</p>
+
+<pre>
+@Override
+public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent event : dataEvents) {
+ if (event.getType() == DataEvent.TYPE_CHANGED &&
+ event.getDataItem().getUri().getPath().equals("/image")) {
+ BundleDataItem bundleDataItem = BundleDataItem.fromDataItem(dataItem);
+ Asset profileAsset = bundleDataItem.getData().getParcelable("profileImage");
+ Bitmap bitmap = loadBitmapFromAsset(profileAsset);
+ // Do something with the bitmap
+ }
+ }
+}
+
+public Bitmap loadBitmapFromAsset(Asset asset) {
+ if (asset == null) {
+ throw new IllegalArgumentException("Asset must be non-null");
+ }
+ ConnectionResult result =
+ mGoogleApiClient.blockingConnect(TIMEOUT_MS, TimeUnit.MILLISECONDS);
+ if (!result.isSuccess()) {
+ return null;
+ }
+ // convert asset into a file descriptor and block until it's ready
+ InputStream assetInputStream = Wearable.DataApi.getFdForAsset(
+ mGoogleApiClient, asset).await().getInputStream();
+ mGoogleApiClient.disconnect();
+
+ if (assetInputStream == null) {
+ Log.w(TAG, "Requested an unknown Asset.");
+ return null;
+ }
+ // decode the stream into a bitmap
+ return BitmapFactory.decodeStream(assetInputStream);
+}
+</pre>
diff --git a/docs/html/training/wearables/data-layer/data-items.jd b/docs/html/training/wearables/data-layer/data-items.jd
new file mode 100644
index 0000000..c39e37a
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/data-items.jd
@@ -0,0 +1,124 @@
+page.title=Syncing Data Items
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#SyncData">Sync Data with a Data Map</a></li>
+ <li><a href="#ListenEvents">Listen for Data Item Events</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>
+A <a href="@{docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a>
+defines the data interface that the system uses to synchronize data between handhelds
+and wearables. A <a href="@{docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a> generally
+consists of the following items:</p>
+<ul>
+ <li><b>Payload</b> - A byte array, which you can set with whatever data you wish, allowing you
+ to do your own object serialization and deserialization. The size of the payload is limited
+ to 100KB.</li>
+ <li><b>Path</b> - A unique string that must start with a forward slash (for instance,
+ <code>"/path/to/data"</code>)</li>
+</ul>
+
+<p>
+You normally don't implement <a href="@{docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a>
+directly. Instead, you:
+
+<ol>
+ <li>Create a <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html"><code>PutDataRequest</code></a> object,
+ specifying a string path to uniquely identify the item.
+ </li>
+ <li>Call <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html#setData(byte[])">setData()</a> to set
+ the payload.
+ </li>
+ <li>Call <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#putDataItem(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.PutDataRequest)"><code>DataApi.putDataItem()</code></a> to request the system to create the data item.
+ </li>
+ <li>When requesting data items, the system returns objects
+ that properly implement the <a href="{@docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a> interface.
+ </li>
+</ol>
+
+<p>
+However, instead of working with raw bytes using <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html#setData(byte[])">setData()</a>,
+we recommend you <a href="#data-map">use a data map</a>, which exposes
+a data item in an easy-to-use {@link android.os.Bundle}-like interface.
+</p>
+
+<h2 id="SyncData">Sync Data with a Data Map</h2>
+<p>
+When possible, use the <a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html"><code>DataMap</code></a> class,
+which lets you work with data items in the form of an Android {@link android.os.Bundle},
+so object serialization and de-serialization is done for you, and you can manipulate data with key-value pairs.
+</p>
+
+<p>To use a data map:</p>
+
+<ol>
+ <li>Create a
+<a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataMapRequest.html"><code>PutDataMapRequest</code></a>
+object, setting the path of the data item.
+<p class="note"><b>Note:</b> The path string is a unique identifier for the
+data item that allows you to access it from either side of the connection. The path must begin
+with a forward slash. If you're using hierarchical data in your
+app, you should create a path scheme that matches the structure of the data.
+</p>
+</li>
+<li>Call
+<a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataMapRequest.html#getDataMap()"><code>PutDataMapRequest.getDataMap()</code></a>
+</a> to obtain a data map that you can set values on.</li>
+ <li>Set any desired values for the data map using the <code>put...()</code> methods, such as
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html#putString(java.lang.String, java.lang.String)"><code>putString()</code></a>.
+ </li>
+ <li>Call <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataMapRequest.html#asPutDataRequest()"><code>PutDataMapRequest.asPutDataRequest()</code></a>
+ to obtain a <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html"><code>PutDataRequest</code></a> object.
+ </li>
+ <li>Call <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#putDataItem(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.PutDataRequest)"><code>DataApi.putDataItem()</code></a> to request the system to create the data item.
+ <p class="note"><b>Note:</b>
+ If the handset and wearable devices are disconnected,
+ the data is buffered and and synced when the connection is re-established.
+ </p>
+ </li>
+</ol>
+
+<p>The following example shows how to create a data map, set data on it, and create it:</p>
+
+<pre>
+PutDataMapRequest dataMap = PutDataMapRequest.create("/count");
+dataMap.getDataMap().putInt(COUNT_KEY, count++);
+PutDataRequest request = dataMap.asPutDataRequest();
+PendingResult<DataApi.DataItemResult> pendingResult = Wearable.DataApi
+ .putDataItem(mGoogleApiClient, request);
+</pre>
+
+<h2 id="ListenEvents">Listen for Data Item Events</h2>
+If one side of the data layer connection changes a data item, you probably want
+to be notified of any changes on the other side of the connection.
+You can do this by implementing a listener for data item events.
+
+<p>For example, here's what a typical callback looks like to carry out certain actions
+when data changes.</p>
+
+<pre>
+@Override
+public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent event : dataEvents) {
+ if (event.getType() == DataEvent.TYPE_DELETED) {
+ Log.d(TAG, "DataItem deleted: " + event.getDataItem().getUri());
+ } else if (event.getType() == DataEvent.TYPE_CHANGED) {
+ Log.d(TAG, "DataItem changed: " + event.getDataItem().getUri());
+ }
+ }
+}
+</pre>
+<p>
+This is just a snippet that requires more implementation details. Learn about
+how to implement a full listener service or activity in
+<a href="{@docRoot}training/wearables/data-layer/listeners.html">Listening for Data Layer Events</a>.
+</p>
\ No newline at end of file
diff --git a/docs/html/training/wearables/data-layer/events.jd b/docs/html/training/wearables/data-layer/events.jd
new file mode 100644
index 0000000..0146c4e
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/events.jd
@@ -0,0 +1,312 @@
+page.title=Handling Data Layer Events
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#Wait">Wait for the Status of Data Layer Calls</a></li>
+ <li><a href="#Listen">Listen for Data Layer Events</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>When you make calls with the data layer, you can receive the status
+of the call when it completes as well as listen for any changes that
+the call ends up making with listeners.
+</p>
+
+<h2 id="Wait">Wait for the Status of Data Layer Calls</h2>
+
+<p>You'll notice that calls to the data layer API sometimes return a
+<a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html"><code>PendingResult</code></a>,
+such as
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#putDataItem(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.PutDataRequest)"><code>putDataItem()</code></a>.
+As soon as the <a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html"><code>PendingResult</code></a> is created,
+the operation is queued in the background. If you do nothing else after this, the operation
+eventually completes silently. However, you'll usually want to do something with the result
+after the operation completes, so the
+<a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html"><code>PendingResult</code></a>
+lets you wait for the result status, either synchronously or asynchronously.
+</p>
+
+<h3 id="async-waiting">Asynchronously waiting</h3>
+<p>If your code is running on the main UI thread, do not making blocking calls
+to the data layer API. You can run the calls asynchronously by adding a callback
+to the <a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html"><code>PendingResult</code></a> object,
+which fires when the operation is completed:</p>
+<pre>
+pendingResult.setResultCallback(new ResultCallback<DataItemResult>() {
+ @Override
+ public void onResult(final DataItemResult result) {
+ if(result.getStatus().isSuccess()) {
+ Log.d(TAG, "Data item set: " + result.getDataItem().getUri());
+ }
+});
+</pre>
+
+<h3 id="sync-waiting">Synchronously waiting</h3>
+<p>If your code is running on a separate handler thread in a background service (which is the case
+in a <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>),
+it's fine for the calls to block. In this case, you can call
+<a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html#await()"><code>await()</code></a>
+on the PendingResult object, which will block until the request has completed, and return a Result
+object:
+</p>
+
+<pre>
+DataItemResult result = pendingResult.await();
+if(result.getStatus().isSuccess()) {
+ Log.d(TAG, "Data item set: " + result.getDataItem().getUri());
+}
+</pre>
+
+
+<h2 id="Listen">Listen for Data Layer Events </h2>
+<p>Because the data layer synchronizes and sends data across the handheld and
+wearable, you normally want to listen for important events, such as when data items
+are created, messages are received, or when the wearable and handset are connected.
+</p>
+<p>To listen for data layer events, you have two options:</p>
+
+<ul>
+ <li>Create a service that extends
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
+ </li>
+ <li>Create an activity that implements
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataApi.DataListener</code></a>.
+ </li>
+</ul>
+
+<p>With both these options, you override any of the data event callbacks that you care about
+handling in your implementation.</p>
+
+<h3 id="listener-service">With a WearableListenerService</h3>
+
+<p>
+You typically create instances of this service in both your wearable and handheld apps. If you
+don't care about data events in one of these apps, then you don't need to implement this
+service in that particular app.</p>
+
+<p>For example, you can have a handheld app that sets and gets data item objects and a wearable app
+that listens for these updates to update it's UI. The wearable never updates any of the data items,
+so the handheld app doesn't listen for any data events from the wearable app.</p>
+
+<p>You can listen for the following events with
+<a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:</p>
+
+<ul>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code></a>
+- Called when data item objects are created, changed, or deleted. An event on one side of a connection
+triggers an this callback on both sides.</li>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)"><code>onMessageReceived()</code></a>
+- A message sent from one side of a connection triggers this callback on the other side of the connection.</li>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onMessageReceived(com.google.android.gms.wearable.MessageEvent)"><code>onPeerConnected()</code></a>
+ and <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html#onPeerDisconnected(com.google.android.gms.wearable.Node)"><code>onPeerDisconnected()</code></a> -
+ Called when connection with the handheld or wearable is connected or disconnected.
+ Changes in connection state on one side of the connection triggers these callbacks on both sides of the connection.
+ </li>
+</ul>
+
+<p>To create a <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:</p>
+
+<ol>
+ <li>Create a class that extends
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
+ </li>
+ <li>Listen for the events that you care about, such as
+ <a href="{@docRoot}/reference/com/google/android/gms/wearable/WearableListenerService.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code></a>.
+ </li>
+ <li>Declare an intent filter in your Android manifest to notify the system about your
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>.
+ This allows the system to bind your service as needed.
+ </li>
+</ol>
+
+ <p>The following example shows how to implement a simple
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>:
+ </p>
+
+<pre>
+public class DataLayerListenerService extends WearableListenerService {
+
+ private static final String TAG = "DataLayerSample";
+ private static final String START_ACTIVITY_PATH = "/start-activity";
+ private static final String DATA_ITEM_RECEIVED_PATH = "/data-item-received";
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "onDataChanged: " + dataEvents);
+ }
+ final List<DataEvent> events = FreezableUtils
+ .freezeIterable(dataEvents);
+
+ GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .build();
+
+ ConnectionResult connectionResult =
+ googleApiClient.blockingConnect(30, TimeUnit.SECONDS);
+
+ if (!connectionResult.isSuccess()) {
+ Log.e(TAG, "Failed to connect to GoogleApiClient.");
+ return;
+ }
+
+ // Loop through the events and send a message
+ / to the node that created the data item.
+ for (DataEvent event : events) {
+ Uri uri = event.getDataItem().getUri();
+
+ // Get the node id from the host value of the URI
+ String nodeId = uri.getHost();
+ // Set the data of the message to be the bytes of the URI.
+ byte[] payload = uri.toString().getBytes();
+
+ // Send the RPC
+ Wearable.MessageApi.sendMessage(googleApiClient, nodeId,
+ DATA_ITEM_RECEIVED_PATH, payload);
+ }
+ }
+}
+</pre>
+
+<p>Here's the corresponding intent filter in the Android manifest file:</p>
+
+<pre>
+<service android:name=".DataLayerListenerService">
+ <intent-filter>
+ <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
+ </intent-filter>
+</service>
+</pre>
+
+
+<h4>Permissions within Data Layer Callbacks</h4>
+
+<p>In order to deliver callbacks to your application for data layer events, Google Play services
+binds to your <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>,
+and calls your callbacks via IPC. This has the consequence
+that your callbacks inherit the permissions of the calling process.</p>
+
+<p>If you try to perform a privileged operation within a callback, the security check fails because your callback is
+running with the identity of the calling process, instead of the identity of your app's
+process.</p>
+
+<p>To fix this, call {@link android.os.Binder#clearCallingIdentity} </a>,
+to reset identity after crossing the IPC boundary, and then restore identity with
+{@link android.os.Binder#restoreCallingIdentity restoreCallingIdentity()} when
+you've completed the privileged operation:
+</p>
+
+<pre>
+long token = Binder.clearCallingIdentity();
+try {
+ performOperationRequiringPermissions();
+} finally {
+ Binder.restoreCallingIdentity(token);
+}
+</pre>
+
+<h3 id="Listen">With a Listener Activity</h3>
+
+<p>
+If your app only cares about data layer events when the user is interacting
+with the app and does not need a long-running service to handle every data
+change, you can listen for events in an activity by implementing one or more
+of the following interfaces:
+
+<ul>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataApi.DataListener</code></a></li>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.MessageListener.html"><code>MessageApi.MessageListener</code></a></li>
+ <li><a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html"><code>NodeApi.NodeListener</code></a></li>
+</ul>
+</p>
+
+<p>To create an activity that listens for data events:</p>
+<ol>
+<li>Implement the desired interfaces.</li>
+<li>In {@link android.app.Activity#onCreate}, create an instance of
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html"><code>GoogleApiClient</code></a>
+to work with the data layer API.
+<li>
+In {@link android.app.Activity#onStart onStart()}, call <a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()"><code>connect()</code></a> to connect the client to Google Play services.
+</li>
+<li>When the connection to Google Play services is established, the system calls
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)"><code>onConnected()</code></a>. This is where you call
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.DataApi.DataListener)"><code>DataApi.addListener()</code></a>,
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.MessageApi.MessageListener)"><code>MessageApi.addListener()</code></a>,
+ or <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.html#addListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.NodeApi.NodeListener)"><code>NodeApi.addListener()</code></a>
+ to notify Google Play services that your activity is interested in listening for data layer events.
+</li>
+<li>In {@link android.app.Activity#onStop onStop()}, unregister any listeners with
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.DataApi.DataListener)"><code>DataApi.removeListener()</code></a>,
+<a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.MessageApi.MessageListener)"><code>MessageApi.removeListener()</code></a>,
+or <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.html#removeListener(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.wearable.NodeApi.NodeListener)"><code>NodeApi.removeListener()</code></a>.
+</li>
+<li>Implement <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html#onDataChanged(com.google.android.gms.wearable.DataEventBuffer)"><code>onDataChanged()</code>,
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerConnected(com.google.android.gms.wearable.Node)"><code>onMessageReceived()</code></a>,
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerConnected(com.google.android.gms.wearable.Node)"><code>onPeerConnected()</code></a>, and
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/NodeApi.NodeListener.html#onPeerDisconnected(com.google.android.gms.wearable.Node)"><code>onPeerDisconnected()</code></a>, depending on the interfaces that you implemented.
+</li>
+</ol>
+
+<p>Here's an example that implements
+<a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataApi.DataListener</code></a>:</p>
+
+<pre>
+public class MainActivity extends Activity implements
+ DataApi.DataListener, ConnectionCallbacks, OnConnectionFailedListener {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ setContentView(R.layout.main);
+ mGoogleApiClient = new GoogleApiClient.Builder(this)
+ .addApi(Wearable.API)
+ .addConnectionCallbacks(this)
+ .addOnConnectionFailedListener(this)
+ .build();
+ }
+
+ @Override
+ protected void onStart() {
+ super.onStart();
+ if (!mResolvingError) {
+ mGoogleApiClient.connect();
+ }
+ }
+
+ @Override
+ public void onConnected(Bundle connectionHint) {
+ if (Log.isLoggable(TAG, Log.DEBUG)) {
+ Log.d(TAG, "Connected to Google Api Service");
+ }
+ Wearable.DataApi.addListener(mGoogleApiClient, this);
+ }
+
+ @Override
+ protected void onStop() {
+ if (null != mGoogleApiClient && mGoogleApiClient.isConnected()) {
+ Wearable.NodeApi.removeListener(mGoogleApiClient, this);
+ mGoogleApiClient.disconnect();
+ }
+ super.onStop();
+ }
+
+ @Override
+ public void onDataChanged(DataEventBuffer dataEvents) {
+ for (DataEvent event : dataEvents) {
+ if (event.getType() == DataEvent.TYPE_DELETED) {
+ Log.d(TAG, "DataItem deleted: " + event.getDataItem().getUri());
+ } else if (event.getType() == DataEvent.TYPE_CHANGED) {
+ Log.d(TAG, "DataItem changed: " + event.getDataItem().getUri());
+ }
+ }
+ }
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/data-layer/index.jd b/docs/html/training/wearables/data-layer/index.jd
new file mode 100644
index 0000000..3e06df1
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/index.jd
@@ -0,0 +1,87 @@
+page.title=Sending and Syncing Data
+@jd:body
+
+<div id="tb-wrapper">
+ <div id="tb">
+
+ <!-- Required platform, tools, add-ons, devices, knowledge, etc. -->
+ <h2>Dependencies and prerequisites</h2>
+ <ul>
+ <li>Android 4.3 (API Level 18) or higher on the handset device</li>
+ <li>The latest version of <a href="{@docRoot}google/play">Google Play services</a></li>
+ <li>An Android Wear device or Wear AVD</li>
+ </ul>
+ </div>
+</div>
+
+<p>
+The Wearable Data Layer API, which is part of Google Play services, provides a communication channel
+for your handheld and wearable apps. The API consists of a set of data objects that the system can
+send and synchronize over the wire and listeners that notify your apps of important events with
+the data layer:</p>
+
+<dl>
+ <dt><b>Data Items</b></dt>
+ <dd>A <a href="{@docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a>
+ provides data storage with automatic syncing between the handheld and
+ wearable.</dd>
+
+ <dt><b>Messages</b></dt>
+ <dd>The <a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html"><code>MessageApi</code></a> class
+ can send messages designed for "fire-and-forget" commands, such as controlling a handheld's
+ media player from the wearable or starting an intent on the wearable from the handheld.
+ The system always delivers the message when the handheld and wearable are connected and delivers
+ an error when the devices are disconnected. Messages are great for one-way requests or for a
+ request/response communication model.</dd>
+
+ <dt><b>Asset</b></dt>
+ <dd><a href="{@docRoot}reference/com/google/android/gms/wearable/Asset.html"><code>Asset</code></a> objects are for
+ sending binary blobs of data, such as images. You attach assets to data items and the system
+ automatically takes care of the transfer for you, conserving Bluetooth bandwidth by caching large assets
+ to avoid re-transmission.</dd>
+
+ <dt><b>WearableListenerService</b> (for services)</dt>
+ <dd><p>Extending <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>
+ lets you listen for important data layer events in a service. The system manages the lifecycle of
+ the <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>,
+ binding to the service when it needs to send data items or messages and unbinding the service when no work is needed.</p>
+ </dd>
+
+ <dt><b>DataListener</b> (for foreground activities)</dt>
+ <dd>
+ Implementing <a href="{@docRoot}reference/com/google/android/gms/wearable/DataApi.DataListener.html"><code>DataListener</code></a>
+ in an activity lets you listen for important data layer events when an activity
+ is in the foreground. Using this instead of the
+ <a href="{@docRoot}reference/com/google/android/gms/wearable/WearableListenerService.html"><code>WearableListenerService</code></a>
+ lets you listen for changes only when the user is actively using your app.
+ </dd>
+</dl>
+
+<p class="warning"><b>Warning:</b>
+Because these APIs are designed for communication between handhelds and wearables,
+these are the only APIs you should use to set up communication between these
+devices. For instance, don't try to open low-level sockets to create a communication
+channel.
+</p>
+
+<h2>Lessons</h2>
+ <dl>
+ <dt><a href="{@docRoot}training/wearables/data-layer/data-items.html">Accessing the Wearable Data Layer</a></dt>
+ <dd>This lesson shows you how to create a client to access the Data Layer APIs.</dd>
+
+ <dt><a href="{@docRoot}training/wearables/data-layer/data-items.html">Syncing Data Items</a></dt>
+ <dd>Data items are objects that are stored in a replicated data store that is automatically
+ synced from handhelds to wearables.</dd>
+
+ <dt><a href="{@docRoot}training/wearables/data-layer/assets.html">Transferring Assets</a></dt>
+ <dd>Assets are binary blobs of data that you typically use to transfer images or media.</dd>
+
+ <dt><a href="{@docRoot}training/wearables/data-layer/stacks.html">Sending and Receiving Messages</a></dt>
+ <dd>Messages are designed for fire-and-forget messages that you can send back and forth
+ between the wearable and handheld.</dd>
+
+ <dt><a href="{@docRoot}training/wearables/data-layer/events.html">Handling Data Layer Events</a></dt>
+ <dd>Be notified of changes and events to the data layer.</dd>
+ </dl>
+
+</div>
\ No newline at end of file
diff --git a/docs/html/training/wearables/data-layer/messages.jd b/docs/html/training/wearables/data-layer/messages.jd
new file mode 100644
index 0000000..a9dec75
--- /dev/null
+++ b/docs/html/training/wearables/data-layer/messages.jd
@@ -0,0 +1,99 @@
+page.title=Sending and Receiving Messages
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#SendMessage">Send a Message</a></li>
+ <li><a href="#ReceiveMessage">Receive a Message</a></li>
+</ol>
+</div>
+</div>
+
+<p>You send messages using the
+<a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.html"><code>MessageApi</code></a>
+and attach the following items to the message:</p>
+
+<ul>
+ <li>An arbitrary payload (optional)</li>
+ <li>A path that uniquely identifies the message's action</li>
+</ul>
+<p>
+Unlike data items, there is no syncing between the handheld and wearable apps.
+Messages are a one-way communication mechanism that's meant for
+"fire-and-forget" tasks, such as sending a message to the wearable
+to start an activity. You can also use messages in request/response model
+where one side of the connection sends a message, does some work,
+sends back a response message.</p>
+
+<h2 id="SendMessage">Send a Message</h2>
+
+<p>The following example shows how to send a message that indicates to the other
+side of the connect to start an activity.
+This call is made synchronously, which blocks until the message
+is received or when the request times out:
+</p>
+
+<p class="note"><b>Note:</b> Read more about asynchronous and synchronous calls
+to Google Play services and when to use each in
+<a href="google/auth/api-client.html#Communicating">Communicate with Google Play Services</a>.
+</p>
+
+<pre>
+Node node; // the connected device to send the message to
+GoogleApiClient mGoogleApiClient;
+public static final START_ACTIVITY_PATH = "/start/MainActivity";
+...
+
+ SendMessageResult result = Wearable.MessageApi.sendMessage(
+ mGoogleApiClient, node, START_ACTIVITY_PATH, null).await();
+ if (!result.getStatus().isSuccess()) {
+ Log.e(TAG, "ERROR: failed to send Message: " + result.getStatus());
+ }
+</pre>
+
+<p>
+Here's a simple way to get a list of connected nodes that you can potentially
+send messages to:</p>
+
+<pre>
+private Collection<String> getNodes() {
+ HashSet <String>results= new HashSet<String>();
+ NodeApi.GetConnectedNodesResult nodes =
+ Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
+ for (Node node : nodes.getNodes()) {
+ results.add(node.getId());
+ }
+ return results;
+}
+</pre>
+
+<h2 id="ReceiveMessage">Receiving a Message</h2>
+
+<p>
+
+To be notified of received messages, you implement a listener for message events.
+This example shows how you might do this by checking the <code>START_ACTIVITY_PATH</code>
+that the previous example used to send the message. If this condition is <code>true</code>,
+a specific activity is started.
+</p>
+
+<pre>
+@Override
+public void onMessageReceived(MessageEvent messageEvent) {
+ if (messageEvent.getPath().equals(START_ACTIVITY_PATH)) {
+ Intent startIntent = new Intent(this, MainActivity.class);
+ startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ startActivity(startIntent);
+ }
+}
+</pre>
+
+<p>
+This is just a snippet that requires more implementation details. Learn about
+how to implement a full listener service or activity in
+<a href="#listening">Listening for Data Layer Events</a>.
+</p>
\ No newline at end of file
diff --git a/docs/html/training/wearables/notifications/creating.jd b/docs/html/training/wearables/notifications/creating.jd
new file mode 100644
index 0000000..174cd82
--- /dev/null
+++ b/docs/html/training/wearables/notifications/creating.jd
@@ -0,0 +1,295 @@
+page.title=Creating a Notification
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#Import">Import the Necessary Classes</a></li>
+ <li><a href="#NotificationBuilder">Create Notifications with the Notification Builder</a></li>
+ <li><a href="#ActionButtons">Add Action Buttons</a></li>
+ <li><a href="#SpecifyWearableOnlyActions">Specify Wearable-only Actions</a></li>
+ <li><a href="#BigView">Add a Big View</a></li>
+ <li><a href="#AddWearableFeatures">Add Wearable Features for a Notification</a></li>
+ <li><a href="#Deliver">Deliver the Notification</a></li>
+</ol>
+
+</div>
+</div>
+
+<p>To build handheld notifications that are also sent to wearables, use
+{@link android.support.v4.app.NotificationCompat.Builder}. When you build
+notifications with this class, the system takes care of displaying
+notifications properly, whether they appear on a handheld or wearable.
+</p>
+
+<p class="note"><strong>Note:</strong>
+Notifications using {@link android.widget.RemoteViews} are stripped of custom
+layouts and the wearable only displays the text and icons. However, you can create
+<a href="{@docRoot}training/wearable/apps/custom-notifications.html">create custom notifications</a>
+that use custom card layouts by creating a wearable app that runs on the wearable device.</p>
+</div>
+
+<h2 id="Import">Import the necessary classes</h2>
+<p>Before you begin, import the necessary classes from the support library:</p>
+
+<pre style="clear:right">
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.NotificationManagerCompat;
+import android.support.v4.app.NotificationCompat.WearableExtender;
+</pre>
+
+<h2 id="NotificationBuilder">Create Notifications with the Notification Builder</h2>
+
+<p>The <a href="http://developer.android.com/tools/support-library/features.html#v4">v4
+support library</a> allows you to create notifications using the latest notification features
+such as action buttons and large icons, while remaining compatible with Android 1.6 (API level
+4) and higher.</p>
+
+<p>To create a notification with the support library, you create an instance of
+{@link android.support.v4.app.NotificationCompat.Builder} and issue the notification by
+passing it to {@link android.support.v4.app.NotificationManagerCompat#notify notify()}. For example:
+</p>
+
+<pre>
+int notificationId = 001;
+// Build intent for notification content
+Intent viewIntent = new Intent(this, ViewEventActivity.class);
+viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
+PendingIntent viewPendingIntent =
+ PendingIntent.getActivity(this, 0, viewIntent, 0);
+
+NotificationCompat.Builder notificationBuilder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.ic_event)
+ .setContentTitle(eventTitle)
+ .setContentText(eventLocation)
+ .setContentIntent(viewPendingIntent);
+
+// Get an instance of the NotificationManager service
+NotificationManagerCompat notificationManager =
+ NotificationManagerCompat.from(this);
+
+// Build the notification and issues it with notification manager.
+notificationManager.notify(notificationId, notificationBuilder.build());
+</pre>
+
+<p>When this notification appears on a handheld device, the user can invoke the
+{@link android.app.PendingIntent}
+specified by the {@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
+setContentIntent()} method by touching the notification. When this
+notification appears on an Android wearable, the user can swipe the notification to the left to
+reveal the <strong>Open</strong> action, which invokes the intent on the handheld device.</p>
+
+
+<img src="{@docRoot}wear/images/circle_email_action.png" height="200"
+ style="float:right;clear:right;margin:0 0 20px 60px" />
+
+<h2 id="ActionButtons">Add Action Buttons</h2>
+
+<p>In addition to the primary content action defined by
+{@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
+setContentIntent()}, you can add other actions by passing a {@link android.app.PendingIntent} to
+the {@link android.support.v4.app.NotificationCompat.Builder#addAction addAction()} method.</p>
+
+<p>For example, the following code shows the same type of notification from above, but adds an
+action to view the event location on a map.</p>
+
+<pre style="clear:right">
+// Build an intent for an action to view a map
+Intent mapIntent = new Intent(Intent.ACTION_VIEW);
+Uri geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location));
+mapIntent.setData(geoUri);
+PendingIntent mapPendingIntent =
+ PendingIntent.getActivity(this, 0, mapIntent, 0);
+
+NotificationCompat.Builder notificationBuilder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.ic_event)
+ .setContentTitle(eventTitle)
+ .setContentText(eventLocation)
+ .setContentIntent(viewPendingIntent)
+ <b>.addAction(R.drawable.ic_map,
+ getString(R.string.map), mapPendingIntent);</b>
+</pre>
+
+<p>On a handheld, the action appears as an
+additional button attached to the notification. On a wearable, the action appears as
+a large button when the user swipes the notification to the left. When the user taps the action,
+the associated intent is invoked on the handheld.</p>
+
+<p class="note"><strong>Tip:</strong> If your notifications include a "Reply" action
+ (such as for a messaging app), you can enhance the behavior by enabling
+ voice input replies directly from the Android wearable. For more information, read
+ <a href="{@docRoot}training/wearables/notifications/remote-input.html">Receiving Remote Input from
+ a Notification</a>.
+</p>
+
+<h2 id="SpecifyWearableOnlyActions">Specify Wearable-only Actions</h2>
+
+<p>
+If you want the actions available on the wearable to be different from those on the handheld,
+then use {@link android.support.v4.app.NotificationCompat.WearableExtender#addAction WearableExtender.addAction()}.
+Once you add an action with this method, the wearable does not display any other actions added with
+{@link android.support.v4.app.NotificationCompat.Builder#addAction NotificationCompat.Builder.addAction()}.
+That is, only the actions added with {@link android.support.v4.app.NotificationCompat.WearableExtender#addAction WearableExtender.addAction()} appear on the wearable and they do not appear on the handheld.
+</p>
+
+<pre>
+// Create an intent for the reply action
+Intent actionIntent = new Intent(this, ActionActivity.class);
+PendingIntent actionPendingIntent =
+ PendingIntent.getActivity(this, 0, actionIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT);
+
+// Create the action
+NotificationCompat.Action action =
+ new NotificationCompat.Action.Builder(R.drawable.ic_action,
+ getString(R.string.label, actionPendingIntent))
+ .build();
+
+// Build the notification and add the action via WearableExtender
+Notification notification =
+ new NotificationCompat.Builder(mContext)
+ .setSmallIcon(R.drawable.ic_message)
+ .setContentTitle(getString(R.string.title))
+ .setContentText(getString(R.string.content))
+ .extend(new WearableExtender().addAction(action))
+ .build();
+</pre>
+<h2 id="BigView">Add a Big View</h2>
+
+<img src="{@docRoot}wear/images/06_images.png" height="200"
+ style="float:right;margin:0 0 20px 40px" />
+
+<p>You can insert extended text content
+to your notification by adding one of the "big view" styles to your notification. On a
+handheld device, users can see the big view content by expanding the notification. On
+a wearable device, the big view content is visible by default.</p>
+
+<p>To add the extended content to your notification, call {@link
+android.support.v4.app.NotificationCompat.Builder#setStyle setStyle()} on the {@link
+android.support.v4.app.NotificationCompat.Builder} object, passing it an instance of either
+{@link android.support.v4.app.NotificationCompat.BigTextStyle BigTextStyle} or
+{@link android.support.v4.app.NotificationCompat.InboxStyle InboxStyle}.</p>
+
+<p>For example, the following code adds an instance of
+{@link android.support.v4.app.NotificationCompat.BigTextStyle} to the event notification,
+in order to include the complete event description (which includes more text than can fit
+into the space provided for {@link android.support.v4.app.NotificationCompat.Builder#setContentText
+setContentText()}).</p>
+
+<pre style="clear:right">
+// Specify the 'big view' content to display the long
+// event description that may not fit the normal content text.
+BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
+bigStyle.bigText(eventDescription);
+
+NotificationCompat.Builder notificationBuilder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.ic_event)
+ .setLargeIcon(BitmapFractory.decodeResource(
+ getResources(), R.drawable.notif_background))
+ .setContentTitle(eventTitle)
+ .setContentText(eventLocation)
+ .setContentIntent(viewPendingIntent)
+ .addAction(R.drawable.ic_map,
+ getString(R.string.map), mapPendingIntent)
+ <b>.setStyle(bigStyle);</b>
+</pre>
+
+<p>Notice that you can add a large background image to any notification using the
+{@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon setLargeIcon()}
+method. For more information about designing notifications with large images, see the
+<a href="{@docRoot}design/wear/index.html">Design Principles of Android
+Wear</a>.</p>
+
+<h2 id="AddWearableFeatures">Add Wearable Features For a Notification</h2>
+
+<p>If you ever need to add wearable-specific options to a notification, such as specifying additional
+pages of content or letting users dictate a text response with voice input, you can use the
+{@link android.support.v4.app.NotificationCompat.WearableExtender} class to
+specify the options. To use this API:</p>
+
+<ol>
+ <li>Create an instance of a {@link android.support.v4.app.NotificationCompat.WearableExtender WearableExtender},
+ setting the wearable-specific options for the notication.</li>
+ <li>Create an instance of
+ {@link android.support.v4.app.NotificationCompat.Builder}, setting the
+ desired properties for your notification as described earlier in this lesson.</li>
+ <li>Call {@link android.support.v4.app.NotificationCompat.Builder#extend extend()} on
+ the notification and pass in the
+ {@link android.support.v4.app.NotificationCompat.WearableExtender WearableExtender}. This applies
+ the wearable options to the notification.</li>
+ <li>Call {@link android.support.v4.app.NotificationCompat.Builder#build} to build the notification.</li>
+</ol>
+
+<p>
+For example, the following code calls the
+{@link android.support.v4.app.NotificationCompat.WearableExtender#setHintHideIcon setHintHideIcon()}
+method to remove the app icon from the notification card.
+</p>
+
+<pre>
+// Create a WearableExtender to add functionality for wearables
+NotificationCompat.WearableExtender wearableExtender =
+ new NotificationCompat.WearableExtender()
+ .setHintHideIcon(true);
+
+// Create a NotificationCompat.Builder to build a standard notification
+// then extend it with the WearableExtender
+Notification notif = new NotificationCompat.Builder(mContext)
+ .setContentTitle("New mail from " + sender)
+ .setContentText(subject)
+ .setSmallIcon(R.drawable.new_mail);
+ .extend(wearableExtender)
+ .build();
+</pre>
+
+<p>The
+ {@link android.support.v4.app.NotificationCompat.WearableExtender#setHintHideIcon setHintHideIcon()}
+ method is just one example of new notification features available with
+ {@link android.support.v4.app.NotificationCompat.WearableExtender}.
+</p>
+
+<p>If you ever need to read wearable-specifc options at a later time, use the corresponding get
+method for the option. This example calls the
+{@link android.support.v4.app.NotificationCompat.WearableExtender#getHintHideIcon()} method to
+get whether or not this notification hides the icon:
+<pre>
+NotificationCompat.WearableExtender wearableExtender =
+ new NotificationCompat.WearableExtender(notif);
+boolean hintHideIcon = wearableExtender.getHintHideIcon();
+</pre>
+
+<h2 id="Deliver">Deliver the Notification</h2>
+<p>When you want to deliver your notifications, always use the
+ {@link android.support.v4.app.NotificationManagerCompat} API instead of
+ {@link android.app.NotificationManager}:</p>
+
+<pre>
+// Get an instance of the NotificationManager service
+NotificationManagerCompat notificationManager =
+ NotificationManagerCompat.from(mContext);
+
+// Issue the notification with notification manager.
+notificationManager.notify(notificationId, notif);
+</pre>
+
+<p>If you use the framework's {@link android.app.NotificationManager}, some
+features from {@link android.support.v4.app.NotificationCompat.WearableExtender}
+do not work, so make sure to use {@link android.support.v4.app.NotificationCompat}.
+</p>
+
+<pre>
+NotificationCompat.WearableExtender wearableExtender =
+ new NotificationCompat.WearableExtender(notif);
+boolean hintHideIcon = wearableExtender.getHintHideIcon();
+ </pre>
+
+<p>The {@link android.support.v4.app.NotificationCompat.WearableExtender} APIs allow you to add
+additional pages to notifications, stack notifications, and more. Continue to the following lessons
+to learn about these features.
+</p>
\ No newline at end of file
diff --git a/docs/html/training/wearables/notifications/index.jd b/docs/html/training/wearables/notifications/index.jd
new file mode 100644
index 0000000..b9ed6fb
--- /dev/null
+++ b/docs/html/training/wearables/notifications/index.jd
@@ -0,0 +1,51 @@
+page.title=Adding Wearable Features to Notifications
+@jd:body
+
+<div id="tb-wrapper">
+ <div id="tb">
+
+ <h2>Dependencies and prerequisites</h2>
+ <ul>
+ <li>Android 1.6 (API Level 4) or higher on the handset device</li>
+ <li>An Android Wear device or Wear AVD</li>
+ <li><a href="{@docRoot}tools/support-library/features.html#v4">The Android v4 support library
+ (or v13, which includes v4)</li>
+ </ul>
+ <h2>You should also read</h2>
+ <ul>
+ <li><a href="{@docRoot}design/wear/index.html">Android Wear Design Principles</a></li>
+ </ul>
+ </div>
+</div>
+
+<p>When an Android handheld (phone or tablet) and Android wearable are connected, the handheld
+automatically shares notifications with the wearable. On the wearable, each
+notification appears as a new card in the <a href="{@docRoot}design/wear/index.html"
+>context stream</a>.</p>
+
+<p>However, to give users the best experience, you should add wearable-specific functionality to the
+notifications you already create. The following lessons show you how to
+create notifications that are catered for handhelds and wearables at the same time.
+</p>
+
+<img src="{@docRoot}wear/images/notification_phone@2x.png" width="700" height="265" />
+
+<p class="caption"><b>Figure 1.</b> The same notification displayed on a handheld and wearable.</p>
+
+<h2>Lessons</h2>
+ <dl>
+ <dt><a href="{@docRoot}training/wearables/notifications/creating.html">Creating a notification</a></dt>
+ <dd>Learn how to create notifications with wearable features with the Android support library.</dd>
+ <dt><a href="{@docRoot}training/wearables/notifications/remote-input.html">Receiving Remote Input
+from a Notification</a></dt>
+ <dd>Learn how to add an action to a wearable notification that receives voice input from users and delivers
+ the transcribed message to your handset app.</dd>
+ <dt><a href="{@docRoot}training/wearables/notifications/pages.html">Adding Pages to a Notification</a></dt>
+ <dd>Learn how to add additional pages of information that are visible when the user
+swipes to the left.</dd>
+ <dt><a href="{@docRoot}training/wearables/notifications/stacks.html">Stacking Notifications</a></dt>
+ <dd>Learn how to place all similar notifications from your app in a stack, allowing users to view
+ each notification individually without adding multiple cards to the card stream.</dd>
+ </dl>
+
+</div>
\ No newline at end of file
diff --git a/docs/html/training/wearables/notifications/pages.jd b/docs/html/training/wearables/notifications/pages.jd
new file mode 100644
index 0000000..1026774
--- /dev/null
+++ b/docs/html/training/wearables/notifications/pages.jd
@@ -0,0 +1,71 @@
+page.title=Adding Pages to a Notification
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li>Add Pages to a Notification</li>
+</ol>
+</div>
+</div>
+
+<p>When you'd like to provide more information without requiring users
+to open your app on their handheld device, you can
+add one or more pages to the notification on the wearable. The additional pages
+appear immediately to the right of the main notification card.
+</p>
+
+<img src="{@docRoot}wear/images/09_pages.png" height="200" style="margin:0 0 20px 0" />
+<img src="{@docRoot}wear/images/08_pages.png" height="200" style="margin:0 0 20px 40px" />
+
+<p>To create a notification with multiple pages:</p>
+<ol>
+ <li>Create the main notification (the first page) with
+ {@link android.support.v4.app.NotificationCompat.Builder},
+ in the way you'd like the notification to appear on a handset.</li>
+ <li>Create the additional pages for the wearable with
+ {@link android.support.v4.app.NotificationCompat.Builder}.</li>
+ <li>Apply the pages to the main notification with the
+ {@link android.support.v4.app.NotificationCompat.WearableExtender#addPage addPage()}
+ method or add multiple pages in a {@link java.util.Collection} with the
+ {@link android.support.v4.app.NotificationCompat.WearableExtender#addPage addPages()} method.
+ </li>
+</ol>
+
+<p>For example, here's some code that adds a second page to a notification:</p>
+
+<pre>
+// Create builder for the main notification
+NotificationCompat.Builder notificationBuilder =
+ new NotificationCompat.Builder(this)
+ .setSmallIcon(R.drawable.new_message)
+ .setContentTitle("Page 1")
+ .setContentText("Short message")
+ .setContentIntent(viewPendingIntent);
+
+// Create a big text style for the second page
+BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
+secondPageStyle.setBigContentTitle("Page 2")
+ .bigText("A lot of text...");
+
+// Create second page notification
+Notification secondPageNotification =
+ new NotificationCompat.Builder(this)
+ .setStyle(secondPageStyle)
+ .build();
+
+// Add second page with wearable extender and extend the main notification
+Notification twoPageNotification =
+ new WearableExtender()
+ .addPage(secondPageNotification)
+ .extend(notificationBuilder)
+ .build();
+
+// Issue the notification
+ notificationManager =
+ NotificationManagerCompat.from(this);
+ notificationManager.notify(notificationId, twoPageNotification);
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/notifications/stacks.jd b/docs/html/training/wearables/notifications/stacks.jd
new file mode 100644
index 0000000..e71e74c
--- /dev/null
+++ b/docs/html/training/wearables/notifications/stacks.jd
@@ -0,0 +1,154 @@
+page.title=Stacking Notifications
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#AddGroup">Add Each Notification to a Group</a></li>
+ <li><a href="#AddSummary">Add a Summary Notification</a></li>
+</ol>
+
+</div>
+</div>
+<img src="/wear/images/11_bundles_B.png" height="200" width="169"
+ style="margin:0 0 20px 20px; clear:both; float:right" alt="">
+<img src="/wear/images/11_bundles_A.png" height="200" width="169"
+ style="margin:0 20px 20px 20px; float:right" alt="">
+<p>When creating notifications for a handheld device, you should always aggregate similar
+notifications into a single summary notification. For example, if your app creates notifications
+for received messages, you should not show more than one notification
+on a handheld device—when more than one is message is received, use a single notification
+to provide a summary such as "2 new messages."</p>
+
+<p>However, a summary notification is less useful on an Android wearable because users
+are not able to read details from each message on the wearable (they must open your app on the
+handheld to view more information). So for the wearable device, you should
+group all the notifications together in a stack. The stack of notifications appears as a single
+card, which users can expand to view the details from each notification separately. The new
+{@link android.support.v4.app.NotificationCompat.Builder#setGroup setGroup()} method makes this
+possible while allowing you to still provide only one summary notification on the handheld device.</p>
+
+<h2 id="AddGroup" style="clear:right">Add Each Notification to a Group</h2>
+
+<p>To create a stack, call {@link android.support.v4.app.NotificationCompat.Builder#setGroup setGroup()}
+for each notification you want in the stack and specify a
+group key. Then call {@link android.support.v4.app.NotificationManagerCompat#notify notify()}
+to send it to the wearable.</p>
+
+<pre style="clear:right">
+final static String GROUP_KEY_EMAILS = "group_key_emails";
+
+// Build the notification, setting the group appropriately
+Notification notif = new NotificationCompat.Builder(mContext)
+ .setContentTitle("New mail from " + sender1)
+ .setContentText(subject1)
+ .setSmallIcon(R.drawable.new_mail);
+ .setGroup(GROUP_KEY_EMAILS)
+ .build();
+
+// Issue the notification
+NotificationManagerCompat notificationManager =
+ NotificationManagerCompat.from(this);
+notificationManager.notify(notificationId1, notif);
+</pre>
+
+<p>Later on, when you create another notification, specify
+the same group key. When you call
+{@link android.support.v4.app.NotificationManagerCompat#notify notify()},
+this notification appears in the same stack as the previous notification,
+instead of as a new card:</p>
+
+<pre style="clear:right">
+Notification notif2 = new NotificationCompat.Builder(mContext)
+ .setContentTitle("New mail from " + sender2)
+ .setContentText(subject2)
+ .setSmallIcon(R.drawable.new_mail);
+ .setGroup(GROUP_KEY_EMAILS)
+ .build();
+
+notificationManager.notify(notificationId2, notif2);
+</pre>
+
+<p>By default, notifications appear in the order in which you added them, with the most recent
+ notification visible at the top. You can order notifications in another fashion by calling
+ {@link android.support.v4.app.NotificationCompat.Builder#setSortKey setSortKey()}.</p>
+
+
+<h2 id="AddSummary">Add a Summary Notification</h2>
+
+<img src="{@docRoot}wear/images/notif_summary_framed.png" height="242" width="330" style="float:right;margin:0 0 20px 40px" alt="" />
+
+<p>It's important that you still provide a summary notification that appears on handheld devices.
+So in addition to adding each unique notification to the same stack group, also add a summary
+notification and call {@link android.support.v4.app.NotificationCompat.Builder#setGroupSummary setGroupSummary()}
+on the summary notification.</p>
+
+<p>This notification does not appear in your stack of notifications on the wearable, but
+appears as the only notification on the handheld device.</p>
+
+<pre style="clear:right">
+Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
+ R.drawable.ic_large_icon);
+
+// Create an InboxStyle notification
+Notification summaryNotification = new NotificationCompat.Builder(mContext)
+ .setContentTitle("2 new messages")
+ .setSmallIcon(R.drawable.ic_small_icon)
+ .setLargeIcon(largeIcon)
+ .setStyle(new NotificationCompat.InboxStyle()
+ .addLine("Alex Faaborg Check this out")
+ .addLine("Jeff Chang Launch Party")
+ .setBigContentTitle("2 new messages")
+ .setSummaryText("johndoe@gmail.com"))
+ .setGroup(GROUP_KEY_EMAILS)
+ .setGroupSummary(true)
+ .build();
+
+notificationManager.notify(notificationId3, summaryNotification);
+</pre>
+
+<p>
+This notification uses {@link android.support.v4.app.NotificationCompat.InboxStyle},
+which gives you an easy way to create notifications for email or messaging apps.
+You can use this style, another one defined in {@link android.support.v4.app.NotificationCompat},
+or no style for the summary notification.
+</p>
+
+<p class="note"><b>Tip:</b>
+To style the text like in the example screenshot, see
+<a href="{@docRoot}guide/topics/resources/string-resource.html#StylingWithHTML">Styling
+with HTML markup</a> and
+<a href="{@docRoot}guide/topics/resources/string-resource.html#StylingWithSpannables">Styling
+with Spannables</a>.
+</p>
+
+<p>Summary notifications can also affect notifications on wearables without being displayed on them.
+When creating a summary notification, you can use the
+{@link android.support.v4.app.NotificationCompat.WearableExtender} class and call
+{@link android.support.v4.app.NotificationCompat.WearableExtender#setBackground setBackground()} or
+{@link android.support.v4.app.NotificationCompat.WearableExtender#addAction addAction()} to set
+a background image or an action that applies to the entire stack on the wearable. For instance,
+to set the background for an entire stack of notifications:
+</p>
+
+<pre>
+Bitmap background = BitmapFactory.decodeResource(getResources(),
+ R.drawable.ic_background);
+
+NotificationCompat.WearableExtender wearableExtender =
+ new NotificationCompat.WearableExtender()
+ .setBackground(background);
+
+// Create an InboxStyle notification
+Notification summaryNotificationWithBackground =
+ new NotificationCompat.Builder(mContext)
+ .setContentTitle("2 new messages")
+ ...
+ .extend(wearableExtender)
+ .setGroup(GROUP_KEY_EMAILS)
+ .setGroupSummary(true)
+ .build();
+</pre>
\ No newline at end of file
diff --git a/docs/html/training/wearables/notifications/voice-input.jd b/docs/html/training/wearables/notifications/voice-input.jd
new file mode 100644
index 0000000..976bd86
--- /dev/null
+++ b/docs/html/training/wearables/notifications/voice-input.jd
@@ -0,0 +1,175 @@
+page.title=Receiving Voice Input in a Notification
+
+@jd:body
+
+<div id="tb-wrapper">
+<div id="tb">
+
+<h2>This lesson teaches you to</h2>
+<ol>
+ <li><a href="#VoiceInput">Define the Voice Input</a></li>
+ <li><a href="#AddAction">Add the Voice Input as a Notification Action</li>
+ <li><a href="#ReceiveInput">Receiving the Voice Input as a String</a>
+</ol>
+
+</div>
+</div>
+
+<p>If you have handheld notifications that include an action to input text,
+such as reply to an email, it should normally launch an activity
+on the handheld device to input the text. However, when your notification appears on a wearable,
+there is no keyboard input, so you can let users dictate a reply or provide pre-defined text messages
+using {@link android.support.v4.app.RemoteInput}.
+</p>
+
+<p>When users reply with voice or select one of the available
+messages, the system attaches the text response to the {@link android.content.Intent} you specified
+for the notification action and sends that intent to your handheld app.</p>
+
+<img src="{@docRoot}wear/images/13_voicereply.png" height="200" width="169"
+style="float:right;margin:0 0 20px 40px;clear:right" />
+<img src="{@docRoot}wear/images/03_actions.png" height="200" width="169"
+style="float:right;margin:0 0 20px 40px" />
+
+<p class="note"><strong>Note:</strong> The Android emulator does not support voice input. When
+using the emulator for a wearable device, enable <b>Hardware keyboard present</b> in the AVD settings
+so you can type replies instead.</p>
+
+<h2 id="RemoteInput">Define the Voice Input</h2>
+
+<p>To create an action that supports voice input, create an instance of
+ {@link android.support.v4.app.RemoteInput.Builder} that you can add to your notification action.
+ This class's constructor accepts a string that the system uses as
+ the key for the voice input, which you'll later use to retrieve the text of the
+ input in your handheld app.</p>
+
+<p>For example, here's how to create a
+{@link android.support.v4.app.RemoteInput} object that provides a custom
+label for the voice input prompt:</p>
+
+<pre class="prettyprint">
+// Key for the string that's delivered in the action's intent
+private static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
+
+String replyLabel = getResources().getString(R.string.reply_label);
+
+RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
+ .setLabel(replyLabel)
+ .build();
+</pre>
+
+
+<h3>Add Pre-defined Text Responses</h3>
+
+<img src="{@docRoot}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 that the user can select for quick replies. Call
+ {@link android.support.v4.app.RemoteInput.Builder#setChoices setChoices()} and pass it a string array.</p>
+
+<p>For example, you can define some responses in a resource array:</p>
+
+<p class="code-caption">res/values/strings.xml</code>
+<pre class="prettyprint">
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string-array name="reply_choices">
+ <item>Yes</item>
+ <item>No</item>
+ <item>Maybe</item>
+ </string-array>
+</resources>
+</pre>
+
+<p>Then, inflate the string array and add it to the
+ {@link android.support.v4.app.RemoteInput}:</p>
+
+<pre>
+public static final EXTRA_VOICE_REPLY = "extra_voice_reply";
+...
+String replyLabel = getResources().getString(R.string.reply_label);
+String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
+
+RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
+ .setLabel(replyLabel)
+ .setChoices(replyChoices)
+ .build();
+</pre>
+
+<h2 id="AddAction">Add the Voice Input as a Notification Action</h2>
+
+<p>
+To set the voice input, attach your
+{@link android.support.v4.app.RemoteInput} object to an action using
+{@link android.support.v4.app.NotificationCompat.Action.Builder#addRemoteInput addRemoteInput()}.
+You can then apply the action to the notification. For example:
+</p>
+
+<pre>
+// Create an intent for the reply action
+Intent replyIntent = new Intent(this, ReplyActivity.class);
+PendingIntent replyPendingIntent =
+ PendingIntent.getActivity(this, 0, replyIntent,
+ PendingIntent.FLAG_UPDATE_CURRENT);
+
+// Create the reply action and add the remote input
+NotificationCompat.Action action =
+ new NotificationCompat.Action.Builder(R.drawable.ic_reply_icon,
+ getString(R.string.label, replyPendingIntent))
+ .addRemoteInput(remoteInput)
+ .build();
+
+// Build the notification and add the action via WearableExtender
+Notification notification =
+ new NotificationCompat.Builder(mContext)
+ .setSmallIcon(R.drawable.ic_message)
+ .setContentTitle(getString(R.string.title))
+ .setContentText(getString(R.string.content))
+ .extend(new WearableExtender().addAction(action))
+ .build();
+
+// Issue the notification
+NotificationManagerCompat notificationManager =
+ NotificationManagerCompat.from(mContext);
+notificationManager.notify(notificationId, notification);
+</pre>
+<p>
+When you issue this notification, users can swipe to the left to see the "Reply" action button.
+</p>
+
+<h2 id="ReceiveInput">Receiving the Voice Input as a String</h2>
+<p>
+To receive the user's transcribed message in the activity you declared in the reply action's intent,
+call {@link android.support.v4.app.RemoteInput#getResultsFromIntent getResultsFromIntent()},
+passing in the "Reply" action's intent. This method returns a {@link android.os.Bundle} that
+contains the text response. You can then query the {@link android.os.Bundle} to obtain the response.
+
+<p class="note"><b>Note:</b> Do not use {@link android.content.Intent#getExtras Intent.getExtras()}
+to obtain the voice result, because the voice input is stored as
+{@link android.content.ClipData}. The {@link android.support.v4.app.RemoteInput#getResultsFromIntent
+getResultsFromIntent()} method provides a convenient way to receive a character sequence without
+having to process the {@link android.content.ClipData} yourself.
+</p>
+
+<p>
+The following code shows a method that accepts an intent and returns the voice response,
+which is referenced by the <code>EXTRA_VOICE_REPLY</code> key that is used in the previous examples:
+</p>
+
+<pre>
+/**
+ * Obtain the intent that started this activity by calling
+ * Activity.getIntent() and pass it into this method to
+ * get the associated voice input string.
+ */
+
+private CharSequence getMessageText(Intent intent) {
+ Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
+ if (remoteInput != null) {
+ return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
+ }
+ }
+ return null;
+}
+</pre>
\ No newline at end of file
diff --git a/docs/html/wear/notifications/creating.jd b/docs/html/wear/notifications/creating.jd
deleted file mode 100644
index a5d7da7..0000000
--- a/docs/html/wear/notifications/creating.jd
+++ /dev/null
@@ -1,305 +0,0 @@
-page.title=Creating Notifications for Android Wear
-
-@jd:body
-
-
-<p>When an Android device such as a phone or tablet is connected to an Android wearable,
-all notifications are shared between the devices by default. On the Android wearable, each
-notification appears as a new card in the <a href="{@docRoot}wear/design/user-interface.html#Stream"
->context stream</a>.</p>
-
-<img src="{@docRoot}wear/images/notification_phone@2x.png" width="700" height="265" />
-
-
-<p>So without any effort, your app notifications are available to users on Android Wear.
-However, you can enhance the user experience in several ways. For instance,
-if users may respond to a notification by entering text, such as to reply to
-a message, you can add the ability for users to reply by voice directly from the
-wearable.</p>
-
-<p>To help you provide the best user experience
-for your notifications on Android Wear, this guide shows you how to
-build notifications using standard templates in
-the {@link android.support.v4.app.NotificationCompat.Builder} APIs, plus how to begin
-extending your notification's capabilities for the wearable user experience.</p>
-
-<p class="note"><strong>Note:</strong>
-Notifications using {@link android.widget.RemoteViews} are stripped of custom
-layouts and the system uses only the text and icons in the
-{@link android.app.Notification} object to
-display the notification in a card. However, custom card layouts will be supported by
-the official Android Wear SDK that is coming later.</p>
-</div>
-
-
-
-
-<h2 id="Import">Import the Necessary Classes</h2>
-
-<p>To begin development, you must first complete the instructions in the <a
-href="{@docRoot}wear/preview/start.html">Get Started with the Developer Preview</a> document.
-As mentioned in that document, your app must include
-both the <a href="http://developer.android.com/tools/support-library/features.html#v4">v4 support
-library</a> and the Developer Preview support library. So to get started,
-you should include the following imports in your project code:</p>
-
-<pre>
-import android.support.wearable.notifications.*;
-import android.support.wearable.app.NotificationManagerCompat;
-import android.support.v4.app.NotificationCompat;
-</pre>
-
-<p class="caution"><strong>Caution:</strong>
-The APIs in the current Android Wear Developer Preview are intended for <b>development and testing purposes only</b>, not for production apps. Google may change this Developer Preview significantly prior to the official release of the Android Wear SDK. You may not publicly distribute or ship any application using this Developer Preview, as this Developer Preview will no longer be supported after the official SDK is released (which will cause applications based only on the Developer Preview to break).</p>
-
-
-
-<h2 id="NotificationBuilder">Create Notifications with the Notification Builder</h2>
-
-<p>The <a href="http://developer.android.com/tools/support-library/features.html#v4">v4
-support library</a> allows you to create notifications using the latest notification features
-such as action buttons and large icons, while remaining compatible with Android 1.6 (API level
-4) and higher.</p>
-
-
-<p>For example, here's some code that creates and issues a notification using the
-{@link android.support.v4.app.NotificationCompat} APIs combined with the new
-<a href="{@docRoot}reference/android/support/wearable/app/NotificationManagerCompat.html">
-<code>NotificationManagerCompat</code></a> API:</p>
-
-
-<pre>
-int notificationId = 001;
-// Build intent for notification content
-Intent viewIntent = new Intent(this, ViewEventActivity.class);
-viewIntent.putExtra(EXTRA_EVENT_ID, eventId);
-PendingIntent viewPendingIntent =
- PendingIntent.getActivity(this, 0, viewIntent, 0);
-
-NotificationCompat.Builder notificationBuilder =
- new NotificationCompat.Builder(this)
- .setSmallIcon(R.drawable.ic_event)
- .setContentTitle(eventTitle)
- .setContentText(eventLocation)
- .setContentIntent(viewPendingIntent);
-
-// Get an instance of the NotificationManager service
-NotificationManagerCompat notificationManager =
- NotificationManagerCompat.from(this);
-
-// Build the notification and issues it with notification manager.
-notificationManager.notify(notificationId, notificationBuilder.build());
-</pre>
-
-<p>When this notification appears on a handheld device, the user can invoke the
-{@link android.app.PendingIntent}
-specified by the {@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
-setContentIntent()} method by touching the notification. When this
-notification appears on an Android wearable, the user can swipe the notification to the left to
-reveal the <strong>Open</strong> action, which invokes the intent on the handheld device.</p>
-
-
-
-
-
-
-<img src="{@docRoot}wear/images/circle_email_action.png" height="200" style="float:right;clear:right;margin:0 0 20px 60px" />
-
-<h2 id="ActionButtons">Add Action Buttons</h2>
-
-<p>In addition to the primary content action defined by
-{@link android.support.v4.app.NotificationCompat.Builder#setContentIntent
-setContentIntent()}, you can add other actions by passing a {@link android.app.PendingIntent} to
-the {@link android.support.v4.app.NotificationCompat.Builder#addAction
-addAction()} method.</p>
-
-<p>For example, the following code shows the same type of notification from above, but adds an
-action to view the event location on a map.</p>
-
-<pre style="clear:right">
-// Build an intent for an action to view a map
-Intent mapIntent = new Intent(Intent.ACTION_VIEW);
-Uri geoUri = Uri.parse("geo:0,0?q=" + Uri.encode(location));
-mapIntent.setData(geoUri);
-PendingIntent mapPendingIntent =
- PendingIntent.getActivity(this, 0, mapIntent, 0);
-
-NotificationCompat.Builder notificationBuilder =
- new NotificationCompat.Builder(this)
- .setSmallIcon(R.drawable.ic_event)
- .setContentTitle(eventTitle)
- .setContentText(eventLocation)
- .setContentIntent(viewPendingIntent)
- <b>.addAction(R.drawable.ic_map,
- getString(R.string.map), mapPendingIntent);</b>
-</pre>
-
-<p>On a handheld device, the action appears as an
-additional button attached to the notification. On an Android wearable, the action appears as
-a large button when the user swipes the notification to the left. When the user taps the action,
-the associated {@link android.content.Intent} is invoked on the handheld device.</p>
-
-<p class="note"><strong>Tip:</strong> If your notifications includes a "Reply" action
- (such as for a messaging app), you can enhance the behavior by enabling
- voice input replies directly from the Android wearable. For more information, read
- <a href="{@docRoot}wear/notifications/remote-input.html">Receiving Voice Input from a Notification</a>.
-</p>
-
-<p>For details about designing action buttons (including the icon specifications), see the
-<a href="{@docRoot}wear/design/index.html#NotifictionActions">Design Principles of Android
-Wear</a>.</p>
-
-
-<h2 id="BigView">Add a Big View</h2>
-
-<img src="{@docRoot}wear/images/06_images.png" height="200" style="float:right;margin:0 0 20px 40px" />
-
-<p>You can insert extended text content
-to your notification by adding one of the "big view" styles to your notification. On a
-handheld device, users can see the big view content by expanding the notification,
-while on Android Wear, the big view content is visible by default.</p>
-
-<p>To add the extended content to your notification, call {@link
-android.support.v4.app.NotificationCompat.Builder#setStyle setStyle()} on the {@link
-android.support.v4.app.NotificationCompat.Builder} object, passing it an instance of either
-{@link android.support.v4.app.NotificationCompat.BigTextStyle BigTextStyle} or
-{@link android.support.v4.app.NotificationCompat.InboxStyle InboxStyle}.</p>
-
-<p>For example, the following code adds an instance of
-{@link android.support.v4.app.NotificationCompat.BigTextStyle} to the event notification,
-in order to include the complete event description (which includes more text than can fit
-into the space provided for {@link android.support.v4.app.NotificationCompat.Builder#setContentText
-setContentText()}).</p>
-
-
-<pre style="clear:right">
-// Specify the 'big view' content to display the long
-// event description that may not fit the normal content text.
-BigTextStyle bigStyle = new NotificationCompat.BigTextStyle();
-bigStyle.bigText(eventDescription);
-
-NotificationCompat.Builder notificationBuilder =
- new NotificationCompat.Builder(this)
- .setSmallIcon(R.drawable.ic_event)
- .setLargeIcon(BitmapFractory.decodeResource(
- getResources(), R.drawable.notif_background))
- .setContentTitle(eventTitle)
- .setContentText(eventLocation)
- .setContentIntent(viewPendingIntent)
- .addAction(R.drawable.ic_map,
- getString(R.string.map), mapPendingIntent)
- <b>.setStyle(bigStyle);</b>
-</pre>
-
-<p>Notice that you can add a large background image to any notification using the
-{@link android.support.v4.app.NotificationCompat.Builder#setLargeIcon setLargeIcon()}
-method. For more information about designing notifications with large images, see the
-<a href="{@docRoot}wear/design/index.html#Images">Design Principles of Android
-Wear</a>.</p>
-
-
-
-<h2 id="NewFeatures">Add New Features for Wearables</h2>
-
-<p>The Android Wear preview support library provides new APIs that
- allow you to enhance the user experience for notifications on a wearable device. For example,
- you can add additional pages of content that users can view by swiping to the left, or add the ability
-for users to deliver your app a text response using voice input.</p>
-
-<p>To use these new APIs:</p>
-
-<ol>
- <li>Create an instance of
-{@link android.support.v4.app.NotificationCompat.Builder}, setting the
-desired properties for your notification.</li>
- <li>Create a
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#WearableNotificationOptions.Builder(android.content.Context)"> <code>WearableNotificationOptions.Builder</code></a>, setting the wearable-specific options for the notication.</li>
- <li>Call <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#WearableNotificationOptions.Builder#applyTo"><code>WearableNotificationOptions.Builder.applyTo()</code>
- </a>, passing in the {@link android.support.v4.app.NotificationCompat.Builder}. This applies
- the wearable options to the notification.</li>
-</ol>
-
-<p>
-For example, the following code calls the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#setHintHideIcon(boolean)">
- <code>setHintHideIcon()</code></a> method to remove the app icon from the notification card.
-</p>
-
-<pre>
-// Create a NotificationCompat.Builder for standard notification features
- NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
- .setContentTitle("New mail from " + sender)
- .setContentText(subject)
- .setSmallIcon(R.drawable.new_mail);
-// Create a WearablesNotificationOptions.Builder to add functionality for wearables
- Notification notif = new WearableNotificationOptions.Builder()
- <b>.setHintHideIcon(true)</b>
- .build()
- .applyTo(builder); //apply wearable options to to the original notification
- .build()
-</pre>
-
-<p>The
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#setHintHideIcon(boolean)">
- <code>setHintHideIcon()</code></a> method is just one example of new notification features available with the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html"
- ><code>WearableNotificationOptions.Builder</code></a> class.
-</p>
-
-
-<p>When you want to deliver your notifications, always use the
- <a href="{@docRoot}reference/android/support/wearable/app/NotificationManagerCompat.html">
- <code>NotificationManagerCompat</code></a> API instead of
- {@link android.app.NotificationManager}:</p>
-
-<pre>
-// Get an instance of the NotificationManager service
-NotificationManagerCompat notificationManager =
- NotificationManagerCompat.from(this);
-
-// Issue the notification with notification manager.
-notificationManager.notify(notificationId, notif);
-</pre>
-
-
-<p>If you use the framework's {@link android.app.NotificationManager}, some
-features from <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html"><code>WearableNotificationOptions.Builder</code></a>
-do not work.</p>
-
-
-<p>To continue enhancing your notifications for wearables using
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html"
- ><code>WearableNotificationOptions.Builder</code></a> and other APIs in the
- preview support library, see the following developer guides:</p>
-
- <dl>
- <dt><a href="{@docRoot}wear/notifications/remote-input.html">Receiving Voice Input
-from a Notification</a></dt>
- <dd>Add an action that receives voice input from the user and delivers the
-transcribed message to your app.</dd>
- <dt><a href="{@docRoot}wear/notifications/pages.html">Adding Pages to a Notification</a></dt>
- <dd>Add additional pages of information that are visible when the user
-swipes to the left.</dd>
- <dt><a href="{@docRoot}wear/notifications/stacks.html">Stacking Notifications</a></dt>
- <dd>Place all similar notifications from your app in a stack, allowing each to be
-viewed individually without adding multiple cards to the card stream.</dd>
- </dl>
-
-
-<div class="next-docs">
-
-<div class="col-12">
- <h2 class="norule">You might also want to read:</h2>
- <dl>
- <dt><a href="{@docRoot}training/notify-user/index.html">Notifying the User</a></dt>
- <dd>Learn more about how to create notifications.</dd>
- <dt><a href="{@docRoot}guide/components/intents-filters.html">Intents and Intent Filters</a></dt>
- <dd>Learn everything you need to know about the {@link android.content.Intent}
-APIs, used by notificaton actions.</dd>
- </dl>
-</div>
-</div>
-
-
-</body>
-</html>
diff --git a/docs/html/wear/notifications/pages.jd b/docs/html/wear/notifications/pages.jd
deleted file mode 100644
index 7d18b3f..0000000
--- a/docs/html/wear/notifications/pages.jd
+++ /dev/null
@@ -1,65 +0,0 @@
-page.title=Adding Pages to a Notification
-
-@jd:body
-
-
-<img src="{@docRoot}wear/images/09_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
-<img src="{@docRoot}wear/images/08_pages.png" height="200" style="float:right;margin:0 0 20px 40px" />
-
-<p>When you'd like to provide more information without requiring users
-to open your app on their handheld device, you can
-add one or more pages to the notification on Android Wear. The additional pages
-appear immediately to the right of the main notification card.
-For information about when to use and how to design
-multiple pages, see the
-<a href="{@docRoot}wear/design/index.html#NotificationPages">Design Principles of Android
-Wear</a>.</p>
-
-<p>To create a notification with multiple pages:</p>
-<ol>
- <li>Create the main notification (the first page) the way you'd like the notification to appear on a phone
- or tablet.</li>
- <li>Add pages one at a time with the
-<a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#addPage(android.app.Notification)">
-<code>addPage()</code></a> method, or add multiple pages in a {@link java.util.Collection} with the
-<a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#addPages(java.util.Collection<android.app.Notification>)">
-<code>addPages()</code></a> method.</li>
- <li>Apply the pages to the main notification with the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.html#applyTo(android.support.v4.app.NotificationCompat.Builder)"
- ><code>applyTo()</code></a> method.</li>
-</ol>
-
-
-<p>For example, here's some code that adds a second page to a notification:</p>
-
-<pre>
-// Create builder for the main notification
-NotificationCompat.Builder notificationBuilder =
- new NotificationCompat.Builder(this)
- .setSmallIcon(R.drawable.new_message)
- .setContentTitle("Page 1")
- .setContentText("Short message")
- .setContentIntent(viewPendingIntent);
-
-// Create a big text style for the second page
-BigTextStyle secondPageStyle = new NotificationCompat.BigTextStyle();
-secondPageStyle.setBigContentTitle("Page 2")
- .bigText("A lot of text...");
-
-// Create second page notification
-Notification secondPageNotification =
- new NotificationCompat.Builder(this)
- .setStyle(secondPageStyle)
- .build();
-
-// Add second page with wearable options and apply to main notification
-Notification twoPageNotification =
- new WearableNotificationsOptions.Builder()
- .addPage(secondPageNotification)
- .build()
- .applyTo(notificationBuilder)
- .build();
-</pre>
-
-</body>
-</html>
diff --git a/docs/html/wear/notifications/remote-input.jd b/docs/html/wear/notifications/remote-input.jd
deleted file mode 100644
index 4db8274..0000000
--- a/docs/html/wear/notifications/remote-input.jd
+++ /dev/null
@@ -1,241 +0,0 @@
-page.title=Receiving Voice Input from a Notification
-
-@jd:body
-
-<img src="{@docRoot}wear/images/13_voicereply.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" />
-
-<img src="{@docRoot}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 wearable, you can
- allow users to dictate a reply with voice input. You can also provide pre-defined text
- messages for the user to select.</p>
-
-<p>When the user replies with voice or selects one of the available
-messages, the system sends the message to your app on the connected handheld device.
-The message is attached as an extra in the {@link android.content.Intent} 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>
-
-<p>To create an action that supports voice input, first create an instance of
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html">
-<code>RemoteInput</code></a> using the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> APIs.
- The
- <a href="{@docRoot}reference/android/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 {@link android.content.Intent} extra that carries the reply message
- to your app on the handheld.</p>
-
-<p>For example, here's how to create a new
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html">
-<code>RemoteInput</code></a> object that provides a custom
- label for the voice input prompt:</p>
-
-<pre class="prettyprint">
-// Key for the string that's delivered in the action's intent
-private static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
-
-String replyLabel = getResources().getString(R.string.reply_label);
-
-RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
- .setLabel(replyLabel)
- .build();
-</pre>
-
-
-<h3>Add Pre-defined Text Responses</h3>
-
-<img src="{@docRoot}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 that the user can select for quick replies. Call
- <a href="{@docRoot}reference/android/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>
-
-<p class="code-caption">res/values/strings.xml</code>
-<pre class="prettyprint">
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string-array name="reply_choices">
- <item>Yes</item>
- <item>No</item>
- <item>Maybe</item>
- </string-array>
-</resources>
-</pre>
-
-<p>Then, inflate the string array and add it to the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a>:</p>
-
-<pre>
-String replyLabel = getResources().getString(R.string.reply_label);
-String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
-
-RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
- .setLabel(replyLabel)
- .setChoices(replyChoices)
- .build();
-</pre>
-
-
-
-
-<h2 id="PrimaryAction">Receive Voice Input for the Primary Action</h2>
-
-<p>If "Reply" is your notification's primary action (defined by the {@link
-android.support.v4.app.NotificationCompat.Builder#setContentIntent setContentIntent()}
-method), then you should attach the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the main action using
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#addRemoteInputForContentIntent(android.support.wearable.notifications.RemoteInput)">
-<code>addRemoteInputForContentIntent()</code></a>. For example:</p>
-
-<pre>
-// Create intent for reply action
-Intent replyIntent = new Intent(this, ReplyActivity.class);
-PendingIntent replyPendingIntent =
- PendingIntent.getActivity(this, 0, replyIntent, 0);
-
-// Build the notification
-NotificationCompat.Builder replyNotificationBuilder =
- new NotificationCompat.Builder(this)
- .setSmallIcon(R.drawable.ic_new_message)
- .setContentTitle("Message from Travis")
- .setContentText("I love key lime pie!")
- .setContentIntent(replyPendingIntent);
-
-// Create the remote input
-RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
- .setLabel(replyLabel)
- .build();
-
-// Add remote input to wearable options and apply to notification
-Notification replyNotification =
- new WearableNotificationOptions.Builder()
- .addRemoteInputForContentIntent(remoteInput)
- .build()
- .applyTo(replyNotificationBuilder)
- .build();
-</pre>
-
-<p>By using
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#addRemoteInputForContentIntent(android.support.wearable.notifications.RemoteInput)">
-<code>addRemoteInputForContentIntent()</code></a> to add the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> object to the notification's primary action,
-the button that normally appears as an "Open" action becomes the "Reply" action
-and starts the voice input UI when users select it on Android Wear.</p>
-
-
-
-<h2 id="NewAction">Receive Voice Input for a Secondary Action</h2>
-
-<p>If the "Reply" action is not your notification's primary action and you want to enable
-voice input for a secondary action, add the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to a new action button defined by an
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableAction.html">
-<code>Action</code></a> object.</p>
-
-<p>You should instantiate the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableAction.html">
-<code>WearableAction</code></a> with the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableAction.Builder.html"><code>WearableAction.Builder()</code></a>
-constructor, which takes an icon and text label for the action button, plus the
-{@link android.app.PendingIntent}
-the system should use to invoke your app when the user selects the action. For example:</p>
-
-<pre>
-// Create the pending intent to fire when the user selects the action
-Intent replyIntent = new Intent(this, ReplyActivity.class);
-PendingIntent pendingReplyIntent =
- PendingIntent.getActivity(this, 0, replyIntent, 0);
-
-// Create the remote input
-RemoteInput remoteInput = new RemoteInput.Builder(EXTRA_VOICE_REPLY)
- .setLabel(replyLabel)
- .build();
-
-// Create the notification action
-WearableAction replyAction = new WearableAction.Builder(R.drawable.ic_message,
- "Reply", pendingIntent)
- .addRemoteInput(remoteInput)
- .build();
-</pre>
-
-
-<p>After you add the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html"><code>RemoteInput</code></a> to the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableAction.html">
-<code>Wearablection</code></a>, set the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableAction.html">
-<code>WearableAction</code></a> on the
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html"><code>WearableNotifications.Builder</code></a> using
- <a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationsOptions.Builder.html#addAction(Action)"><code>addAction()</code></a>.
-For example:</p>
-
-<pre>
-// Create basic notification builder
-NotificationCompat.Builder replyNotificationBuilder =
- new NotificationCompat.Builder(this)
- .setContentTitle("New message");
-
-// Create the notification action and add remote input
-WearableAction replyAction = new WearableAction.Builder(R.drawable.ic_message,
- "Reply", pendingIntent)
- .addRemoteInput(remoteInput)
- .build();
-
-// Create wearable notification and add action
-Notification replyNotification =
- new WearableNotificationOptions.Builder()
- .addAction(replyAction)
- .build()
- .applyTo(replyNotificationBuilder)
- .build();
-</pre>
-
-
-<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 {@link android.content.Intent} attached to the action and adds the
-<code>EXTRA_VOICE_REPLY</code> extra (the string
- you passed to the
- <a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.Builder.html"><code>RemoteInput.Builder</code></a> constructor)
- with the user's message as the string value.</p>
-
-<h2 id="ObtainInput">Obtaining the Voice Input as a String</h2>
-<p>To obtain the user's voice input, call
-<a href="{@docRoot}reference/android/support/wearable/notifications/RemoteInput.html#getResultsFromIntent(Intent)"><code>getResultsFromIntent()</code></a>,
-passing in the "Reply" action's intent. This method returns
-a {@link android.os.Bundle} that represents the intent's extras. You can then query the
-{@link android.os.Bundle} to obtain the user's voice input string.
-</p>
-<p>
-The following code shows a method that accepts an intent and returns the voice input string,
-which is referenced by the <code>EXTRA_VOICE_REPLY</code> key that is used in the previous examples:
-</p>
-<pre>
-/**
- * Obtain the intent that started this activity by calling
- * Activity.getIntent() and pass it into this method to
- * get the associated voice input string.
- */
-private String getMessageText(Intent intent) {
- Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
- if (remoteInput != null) {
- return remoteInput.getString(Intent.EXTRA_VOICE_REPLY);
- }
- }
- return null;
-}
-</pre>
-
-</body>
-</html>
diff --git a/docs/html/wear/notifications/stacks.jd b/docs/html/wear/notifications/stacks.jd
deleted file mode 100644
index 3c3dc09..0000000
--- a/docs/html/wear/notifications/stacks.jd
+++ /dev/null
@@ -1,138 +0,0 @@
-page.title=Stacking Notifications
-
-@jd:body
-
-<img src="{@docRoot}wear/images/11_bundles_B.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" alt="" />
-<img src="{@docRoot}wear/images/11_bundles_A.png" height="200" width="169" style="float:right;margin:0 0 20px 40px" alt="" />
-
-<p>When creating notifications for a handheld device, you should always aggregate similar
-notifications into a single summary notification. For example, if your app creates notifications
-for received messages, you should not show more than one notification
-on a handheld device—when more than one is message is received, use a single notification
-to provide a summary such as "2 new messages."</p>
-
-<p>However, a summary notification is less useful on an Android wearable because users
-are not able to read details from each message on the wearable (they must open your app on the
-handheld to view more information). So for the wearable device, you should
-group all the notifications together in a stack. The stack of notifications appears as a single
-card, which users can expand to view the details from each notification separately. The new
-<a href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#setGroup(java.lang.String, int)">
-<code>setGroup()</code></a> method makes this possible while allowing you to still provide
-only one summary notification on the handheld device.</p>
-
-<p>For details about designing notification stacks, see the
-<a href="{@docRoot}wear/design/index.html#NotificationStacks">Design Principles of Android
-Wear</a>.</p>
-
-
-<h2 id="AddGroup">Add Each Notification to a Group</h2>
-
-<p>To create a stack, call <a
-href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#setGroup(java.lang.String, int)">
-<code>setGroup()</code></a> for each notification you want in the stack and specify a
-group key. Then call <a href="{@docRoot}reference/android/support/wearable/app/NotificationManagerCompat.html#notify(int, android.app.Notification)"><code>notify()</code></a> to send it to the wearable.</p>
-
-<pre style="clear:right">
-final static String GROUP_KEY_EMAILS = "group_key_emails";
-
-// Build the notification
-NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
- .setContentTitle("New mail from " + sender1)
- .setContentText(subject1)
- .setSmallIcon(R.drawable.new_mail);
-
-// Set the group with WearableNotificationOptions.Builder and apply to the notification
-Notification notif1 = new WearableNotificationOptions.Builder()
- .setGroup(GROUP_KEY_EMAILS)
- .build()
- .applyTo(builder)
- .build();
-
-// Issue the notification
-NotificationManagerCompat notificationManager =
- NotificationManagerCompat.from(this);
-notificationManager.notify(notificationId1, notif);
-</pre>
-
-<p>Later on, when you create another notification, specify
-the same group key. When you call
-<a href="{@docRoot}reference/android/support/v4/app/NotificationManagerCompat.html#notify(int, android.app.Notification)"><code>notify()</code></a>,
-this notification appears in the same stack as the previous notification,
-instead of as a new card:</p>
-
-<pre style="clear:right">
-builder = new NotificationCompat.Builder(mContext)
- .setContentTitle("New mail from " + sender2)
- .setContentText(subject2)
- .setSmallIcon(R.drawable.new_mail);
-
-// Use the same group as the previous notification
-Notification notif2 = new WearableNotificationOptions.Builder()
- .setGroup(GROUP_KEY_EMAILS)
- .build()
- .applyTo(builder)
- .build();
-
-notificationManager.notify(notificationId2, notif);
-</pre>
-
-<p>By default, notifications appear in the order in which you added them, with the most recent
- notification visible at the top. You can define a specific position in the group
- by passing an order position as the second parameter for <a
-href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationOptions.Builder.html#setGroup(java.lang.String, int)">
-<code>setGroup()</code></a>.</p>
-
-
-<h2 id="AddSummary">Add a Summary Notification</h2>
-
-<img src="{@docRoot}wear/images/notif_summary_framed.png" height="242" width="330" style="float:right;margin:0 0 20px 40px" alt="" />
-
-<p>It's important that you still provide a summary notification that appears on handheld devices.
-So in addition to adding each unique notification to the same stack group, also add a summary
-notification, but set its order position to be <a
-href="{@docRoot}reference/android/support/wearable/notifications/WearableNotificationsOptions.html#GROUP_ORDER_SUMMARY"><code>GROUP_ORDER_SUMMARY</code></a>.</p>
-
-<p>This notification does not appear in your stack of notifications on the wearable, but
-appears as the only notification on the handheld device.</p>
-
-<pre style="clear:right">
-Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
- R.drawable.ic_large_icon);
-
-// Create an InboxStyle notification
-builder = new NotificationCompat.Builder(this)
- .setContentTitle("2 new messages")
- .setSmallIcon(R.drawable.ic_small_icon)
- .setLargeIcon(largeIcon)
- .setStyle(new NotificationCompat.InboxStyle()
- .addLine("Alex Faaborg Check this out")
- .addLine("Jeff Chang Launch Party")
- .setBigContentTitle("2 new messages")
- .setSummaryText("johndoe@gmail.com"));
-
-// Specify the notification to be the group summary
-Notification summaryNotification = new WearableNotificationOptions.Builder()
- .setGroupSummary(GROUP_KEY_EMAILS)
- .build()
- .applyTo(builder)
- .build();
-
-notificationManager.notify(notificationId3, summaryNotification);
-</pre>
-
-<p>
-This notification uses {@link android.support.v4.app.NotificationCompat.InboxStyle},
-which gives you an easy way to create notifications for email or messaging apps.
-You can use this style, another one defined in {@link android.support.v4.app.NotificationCompat},
-or no style for the summary notification.
-</p>
-
-<p class="note"><b>Tip:</b>
-To style the text like in the example screenshot, see
-<a href="{@docRoot}guide/topics/resources/string-resource.html#StylingWithHTML">Styling
-with HTML markup</a> and
-<a href="{@docRoot}guide/topics/resources/string-resource.html#StylingWithSpannables">Styling
-with Spannables</a>.
-</p>
-</body>
-</html>
\ No newline at end of file