summaryrefslogtreecommitdiffstats
path: root/docs/html/training/wearables
diff options
context:
space:
mode:
Diffstat (limited to 'docs/html/training/wearables')
-rw-r--r--docs/html/training/wearables/apps/bt-debugging.jd7
-rw-r--r--docs/html/training/wearables/apps/creating.jd5
-rw-r--r--docs/html/training/wearables/apps/index.jd5
-rw-r--r--docs/html/training/wearables/apps/layouts.jd12
-rw-r--r--docs/html/training/wearables/data-layer/accessing.jd33
-rw-r--r--docs/html/training/wearables/data-layer/assets.jd14
-rw-r--r--docs/html/training/wearables/data-layer/data-items.jd28
-rw-r--r--docs/html/training/wearables/data-layer/events.jd46
-rw-r--r--docs/html/training/wearables/data-layer/index.jd6
-rw-r--r--docs/html/training/wearables/data-layer/messages.jd34
-rw-r--r--docs/html/training/wearables/notifications/creating.jd17
-rw-r--r--docs/html/training/wearables/notifications/index.jd4
-rw-r--r--docs/html/training/wearables/notifications/pages.jd13
-rw-r--r--docs/html/training/wearables/notifications/stacks.jd6
-rw-r--r--docs/html/training/wearables/notifications/voice-input.jd13
-rw-r--r--docs/html/training/wearables/ui/index.jd1
16 files changed, 129 insertions, 115 deletions
diff --git a/docs/html/training/wearables/apps/bt-debugging.jd b/docs/html/training/wearables/apps/bt-debugging.jd
index 8d09c43..7569e7e 100644
--- a/docs/html/training/wearables/apps/bt-debugging.jd
+++ b/docs/html/training/wearables/apps/bt-debugging.jd
@@ -19,7 +19,7 @@ page.title=Debugging over Bluetooth
</div>
</div>
-<p>You can debug your wearable over Bluetooth by routing it's debug output to the
+<p>You can debug your wearable over Bluetooth by routing its debug output to the
handheld device that's connected to your development machine.</p>
<h2 id="SetupDevices">Setup Devices for Debugging</h2>
@@ -58,7 +58,8 @@ Target: connected
</li>
<li>Connect the handheld to your machine over USB and run:
<pre>
-adb forward tcp:4444 localabstract:/adb-hub; adb connect localhost:4444
+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>
@@ -89,4 +90,4 @@ adb -e &lt;command&gt;
adb -e logcat
adb -e shell
adb -e bugreport
-</pre> \ No newline at end of file
+</pre>
diff --git a/docs/html/training/wearables/apps/creating.jd b/docs/html/training/wearables/apps/creating.jd
index 7252ada..018d9f7 100644
--- a/docs/html/training/wearables/apps/creating.jd
+++ b/docs/html/training/wearables/apps/creating.jd
@@ -92,6 +92,11 @@ types of screen shapes, which is useful for testing.</p>
<li>Leave the Android Wear app open on your phone.</li>
<li>Connect the wearable to your machine through USB, so you can install apps directly to it
as you develop. A message appears on both the wearable and the Android Wear app prompting you to allow debugging.</li>
+ <p class="note"><strong>Note:</strong> If you can not connect your wearable to your machine via USB,
+ follow the directions on
+ <a href="{@docRoot}training/wearables/apps/bt-debugging.html">Debugging over
+ Bluetooth</a>.
+ </p>
<li>On the Android Wear app, check <strong>Always allow from this computer</strong> and tap
<strong>OK</strong>.</li>
</ol>
diff --git a/docs/html/training/wearables/apps/index.jd b/docs/html/training/wearables/apps/index.jd
index 7d961b7..4bdd6bf 100644
--- a/docs/html/training/wearables/apps/index.jd
+++ b/docs/html/training/wearables/apps/index.jd
@@ -1,5 +1,6 @@
page.title=Creating Wearable Apps
-page.image=wear/images/notifications.png
+page.tags="wear","wearable","app"
+page.image=wear/images/01_create.png
@jd:body
@@ -63,7 +64,7 @@ in ADT. The rest of this training assumes you're using Android Studio.
<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
+ <dd>Learn how to launch an activity with 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
diff --git a/docs/html/training/wearables/apps/layouts.jd b/docs/html/training/wearables/apps/layouts.jd
index e62d3e5..a35acb0 100644
--- a/docs/html/training/wearables/apps/layouts.jd
+++ b/docs/html/training/wearables/apps/layouts.jd
@@ -90,9 +90,10 @@ PendingIntent notificationPendingIntent = PendingIntent.getActivity(this, 0, not
</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>
+The Wearable UI Library is automatically included when you create your wearable
+app with the Android Studio Project Wizard. You can also add this library to your <code>build.gradle</code>
file with the following dependency declaration:
+</p>
<pre>
dependencies {
@@ -101,8 +102,11 @@ dependencies {
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>
+
+<p>This library helps you build UIs that are designed for wearables. For more information, see
+<a href="{@docRoot}training/wearables/ui/index.html">Creating Custom UIs for Wear Devices</a>.</p>
+
+<p>Here are some of the major classes in the Wearable UI Library:</p>
<ul>
<li><code>BoxInsetLayout</code> - A FrameLayout that's aware of screen shape and can box its
diff --git a/docs/html/training/wearables/data-layer/accessing.jd b/docs/html/training/wearables/data-layer/accessing.jd
index 896a698..0c0a2d5 100644
--- a/docs/html/training/wearables/data-layer/accessing.jd
+++ b/docs/html/training/wearables/data-layer/accessing.jd
@@ -12,15 +12,15 @@ page.title=Accessing the Wearable Data Layer
<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
+ <li><a href="{@docRoot}training/wearables/apps/creating.html#SetupEmulator">Creating
+ Wearable Apps > Set Up an Android Wear Emulator or Device</a></li>
+ <li><a href="{@docRoot}training/wearables/apps/creating.html#CreateProject">Creating
Wearable Apps > Creating a Project</a></li>
</ol>
</div>
</div>
-<p>To call the data layer API, create an instance of
+<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>
@@ -37,12 +37,12 @@ for more information about creating a <a href="{@docRoot}reference/com/google/an
implementing its callbacks, and handling error cases.</p>
<pre style="clear:right">
-GoogleApiClient mGoogleAppiClient = new GoogleApiClient.Builder(this)
+GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this)
.addConnectionCallbacks(new ConnectionCallbacks() {
&#64;Override
public void onConnected(Bundle connectionHint) {
Log.d(TAG, "onConnected: " + connectionHint);
- // Now you can use the data layer API
+ // Now you can use the Data Layer API
}
&#64;Override
public void onConnectionSuspended(int cause) {
@@ -55,13 +55,26 @@ GoogleApiClient mGoogleAppiClient = new GoogleApiClient.Builder(this)
Log.d(TAG, "onConnectionFailed: " + result);
}
})
+ // Request access only to the Wearable API
.addApi(Wearable.API)
.build();
</pre>
+<p class="caution">
+<strong>Important:</strong> To avoid client connection errors on devices that do not have the
+<a href="https://play.google.com/store/apps/details?id=com.google.android.wearable.app&hl=en">Android
+Wear app</a> installed, use a separate <a
+href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html">{@code
+GoogleApiClient}</a> instance to access only the <a
+href="{@docRoot}reference/com/google/android/gms/wearable/Wearable.html">{@code
+Wearable}</a> API. For more information, see <a
+href="{@docRoot}google/auth/api-client.html#WearableApi">Access the Wearable API</a>.</p>
+
<p>Before you use the data layer API, start a connection on your client by calling the
-<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()">connect()</a>
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.html#connect()">
+<code>connect()</code></a>
method, as described in
-<a href="{@docRoot}google/auth/api-client.html#Starting">Accessing Google Play services APIs</a>.
-When the system invokes the <code>onConnected()</code> callback for your client, you're ready
-to use the data layer API.</p> \ No newline at end of file
+<a href="{@docRoot}google/auth/api-client.html#Starting">Start a Connection</a>.
+When the system invokes the
+<a href="{@docRoot}reference/com/google/android/gms/common/api/GoogleApiClient.ConnectionCallbacks.html#onConnected(android.os.Bundle)">
+<code>onConnected()</code></a> callback for your client, you're ready to use the Data Layer API.</p>
diff --git a/docs/html/training/wearables/data-layer/assets.jd b/docs/html/training/wearables/data-layer/assets.jd
index 5dc11cb..719ccbc 100644
--- a/docs/html/training/wearables/data-layer/assets.jd
+++ b/docs/html/training/wearables/data-layer/assets.jd
@@ -16,18 +16,18 @@ page.title=Transferring Assets
<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
+<a href="{@docRoot}reference/com/google/android/gms/wearable/Asset.html"><code>Asset</code></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.
+for display on the wearable, and transmit it to the wearable app as an asset. The following examples
+demonstrate 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
+<p class="note"><b>Note:</b> Although the size of data items is limited to 100KB,
+assets can be as large as desired. However, transferring large assets affects the
user experience in many cases, so test your apps to ensure that they perform well
if you're transferring large assets.
<p>
@@ -49,7 +49,6 @@ private static Asset createAssetFromBitmap(Bitmap bitmap) {
</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>
@@ -77,12 +76,13 @@ PendingResult&lt;DataApi.DataItemResult&gt; 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:
+callback to detect an asset change and extract the asset:
</p>
<pre>
diff --git a/docs/html/training/wearables/data-layer/data-items.jd b/docs/html/training/wearables/data-layer/data-items.jd
index 63c32ea..12babbf 100644
--- a/docs/html/training/wearables/data-layer/data-items.jd
+++ b/docs/html/training/wearables/data-layer/data-items.jd
@@ -15,9 +15,9 @@ page.title=Syncing Data Items
</div>
<p>
-A <a href="@{docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a>
+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
+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
@@ -28,15 +28,15 @@ consists of the following items:</p>
</ul>
<p>
-You normally don't implement <a href="@{docRoot}reference/com/google/android/gms/wearable/DataItem.html"><code>DataItem</code></a>
+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>Call <a href="{@docRoot}reference/com/google/android/gms/wearable/PutDataRequest.html#setData(byte[])">
+ <code>setData()</code></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>
@@ -47,14 +47,15 @@ directly. Instead, you:
<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
+we recommend you <a href="#SyncData">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},
+When possible, use the <a href="{@docRoot}reference/com/google/android/gms/wearable/DataMap.html"><code>DataMap</code></a> class.
+This approach 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>
@@ -67,7 +68,7 @@ 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.
+app, you should create a path scheme that matches the structure of the data.
</p>
</li>
<li>Call
@@ -82,12 +83,12 @@ app, you should create a path scheme that matches the structure of the data.
<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.
+ the data is buffered 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>
+<p>The following example shows how to create a data map and put data on it:</p>
<pre>
PutDataMapRequest dataMap = PutDataMapRequest.create("/count");
@@ -103,7 +104,7 @@ 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>
+when data changes:</p>
<pre>
&#64;Override
@@ -120,5 +121,6 @@ public void onDataChanged(DataEventBuffer dataEvents) {
<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/events.html">Listening for Data Layer Events</a>.
+<a href="{@docRoot}training/wearables/data-layer/events.html#Listen">Listen 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
index 9e8acbc..6a3949a 100644
--- a/docs/html/training/wearables/data-layer/events.jd
+++ b/docs/html/training/wearables/data-layer/events.jd
@@ -14,14 +14,14 @@ page.title=Handling Data Layer Events
</div>
</div>
-<p>When you make calls with the data layer, you can receive the status
+<p>When you make calls to the Data Layer API, 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
+<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>.
@@ -33,9 +33,9 @@ after the operation completes, so the
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
+<h3 id="async-waiting">Asynchronous calls</h3>
+<p>If your code is running on the main UI thread, do not make blocking calls
+to the Data Layer API. You can run the calls asynchronously by adding a callback method
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>
@@ -49,12 +49,14 @@ pendingResult.setResultCallback(new ResultCallback&lt;DataItemResult&gt;() {
});
</pre>
-<h3 id="sync-waiting">Synchronously waiting</h3>
+<h3 id="sync-waiting">Synchronous calls</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
+on the <a href="{@docRoot}reference/com/google/android/gms/common/api/PendingResult.html"><code>PendingResult</code></a>
+object, which blocks until the request completes and returns a
+<a href="{@docRoot}reference/com/google/android/gms/common/api/Result.html"><code>Result</code></a>
object:
</p>
@@ -82,14 +84,14 @@ are created, messages are received, or when the wearable and handset are connect
</li>
</ul>
-<p>With both these options, you override any of the data event callbacks that you care about
-handling in your implementation.</p>
+<p>With both these options, you override the data event callback methods for the events you
+are interested in handling.</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
+are not interested in 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
@@ -107,8 +109,9 @@ triggers this callback on both sides.</li>
- 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.
+ Called when the connection with the handheld or wearable is connected or disconnected.
+ Changes in connection state on one side of the connection trigger these callbacks on both sides
+ of the connection.
</li>
</ul>
@@ -118,8 +121,8 @@ triggers this callback on both sides.</li>
<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>Listen for the events that you're interested in, 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>.
@@ -159,13 +162,13 @@ public class DataLayerListenerService extends WearableListenerService {
}
// Loop through the events and send a message
- / to the node that created the data item.
+ // 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.
+ // Set the data of the message to be the bytes of the URI
byte[] payload = uri.toString().getBytes();
// Send the RPC
@@ -189,7 +192,8 @@ public class DataLayerListenerService extends WearableListenerService {
<h4>Permissions within Data Layer Callbacks</h4>
-<p>In order to deliver callbacks to your application for data layer events, Google Play services
+<p>
+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>
@@ -233,7 +237,7 @@ of the following interfaces:
<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.
+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>
@@ -283,7 +287,7 @@ public class MainActivity extends Activity implements
}
}
- &#64;Override
+ &#64;Override
public void onConnected(Bundle connectionHint) {
if (Log.isLoggable(TAG, Log.DEBUG)) {
Log.d(TAG, "Connected to Google Api Service");
@@ -306,8 +310,8 @@ public class MainActivity extends Activity implements
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());
+ Log.d(TAG, "DataItem changed: " + event.getDataItem().getUri());
}
}
}
-</pre> \ No newline at end of file
+</pre>
diff --git a/docs/html/training/wearables/data-layer/index.jd b/docs/html/training/wearables/data-layer/index.jd
index 39d6561..8d42ae3 100644
--- a/docs/html/training/wearables/data-layer/index.jd
+++ b/docs/html/training/wearables/data-layer/index.jd
@@ -8,7 +8,7 @@ page.title=Sending and Syncing Data
<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>The latest version of <a href="{@docRoot}google/play-services/index.html">Google Play services</a></li>
<li>An Android Wear device or Wear AVD</li>
</ul>
</div>
@@ -66,7 +66,7 @@ channel.
<h2>Lessons</h2>
<dl>
- <dt><a href="{@docRoot}training/wearables/data-layer/data-items.html">Accessing the Wearable Data Layer</a></dt>
+ <dt><a href="{@docRoot}training/wearables/data-layer/accessing.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>
@@ -83,5 +83,3 @@ channel.
<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
index 71f1bb1..822e395 100644
--- a/docs/html/training/wearables/data-layer/messages.jd
+++ b/docs/html/training/wearables/data-layer/messages.jd
@@ -22,20 +22,16 @@ and attach the following items to the message:</p>
<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.
+Unlike with data items, there is no syncing between the handheld and wearable apps.
Messages are a one-way communication mechanism that's good for remote procedure calls (RPC),
-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>
+such as sending a message to the wearable to start an activity.</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>
+side of the connection to start an activity.
+This call is synchronous and blocks processing until the message is received or until 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
@@ -61,7 +57,7 @@ send messages to:</p>
<pre>
private Collection&lt;String&gt; getNodes() {
- HashSet &lt;String&gt;results= new HashSet&lt;String&gt;();
+ HashSet &lt;String&gt;results = new HashSet&lt;String&gt;();
NodeApi.GetConnectedNodesResult nodes =
Wearable.NodeApi.getConnectedNodes(mGoogleApiClient).await();
for (Node node : nodes.getNodes()) {
@@ -71,14 +67,17 @@ private Collection&lt;String&gt; getNodes() {
}
</pre>
-<h2 id="ReceiveMessage">Receiving a Message</h2>
+<h2 id="ReceiveMessage">Receive 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.
+To be notified of received messages, you implement the
+<a href="{@docRoot}reference/com/google/android/gms/wearable/MessageApi.MessageListener.html">
+<code>MessageListener</code></a> interface to provide a listener for message events. Then you register your
+listener with the
+<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> method. This example shows how you might implement the listener
+to check 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>
@@ -95,5 +94,6 @@ public void onMessageReceived(MessageEvent messageEvent) {
<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/events.html">Listening for Data Layer Events</a>.
+<a href="{@docRoot}training/wearables/data-layer/events.html#Listen">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
index 84e3311..57ac36e 100644
--- a/docs/html/training/wearables/notifications/creating.jd
+++ b/docs/html/training/wearables/notifications/creating.jd
@@ -4,7 +4,6 @@ page.title=Creating a Notification
<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>
@@ -30,7 +29,6 @@ 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/wearables/apps/layouts.html#CustomNotifications">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>
@@ -255,7 +253,7 @@ NotificationCompat.WearableExtender wearableExtender =
Notification notif = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender)
.setContentText(subject)
- .setSmallIcon(R.drawable.new_mail);
+ .setSmallIcon(R.drawable.new_mail)
.extend(wearableExtender)
.build();
</pre>
@@ -278,7 +276,7 @@ method, in the <code>res/drawable-hdpi</code> directory of your handheld app.</p
<p>If you ever need to read wearable-specific 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:
+get whether or not this notification hides the icon:</p>
<pre>
NotificationCompat.WearableExtender wearableExtender =
new NotificationCompat.WearableExtender(notif);
@@ -304,14 +302,3 @@ notificationManager.notify(notificationId, notif);
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>
diff --git a/docs/html/training/wearables/notifications/index.jd b/docs/html/training/wearables/notifications/index.jd
index 17f3cb3..2833dfa 100644
--- a/docs/html/training/wearables/notifications/index.jd
+++ b/docs/html/training/wearables/notifications/index.jd
@@ -1,4 +1,6 @@
page.title=Adding Wearable Features to Notifications
+page.tags="wear","notifications","wearables"
+page.image=wear/images/01_notifications.png
@jd:body
<div id="tb-wrapper">
@@ -47,5 +49,3 @@ swipes to the left.</dd>
<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
index d74c8ea..6315037 100644
--- a/docs/html/training/wearables/notifications/pages.jd
+++ b/docs/html/training/wearables/notifications/pages.jd
@@ -57,15 +57,14 @@ Notification secondPageNotification =
.setStyle(secondPageStyle)
.build();
-// Add second page with wearable extender and extend the main notification
-Notification twoPageNotification =
- new WearableExtender()
- .addPage(secondPageNotification)
- .extend(notificationBuilder)
- .build();
+// Extend the notification builder with the second page
+Notification notification = notificationBuilder
+ .extend(new NotificationCompat.WearableExtender()
+ .addPage(secondPageNotification))
+ .build();
// Issue the notification
notificationManager =
NotificationManagerCompat.from(this);
-notificationManager.notify(notificationId, twoPageNotification);
+notificationManager.notify(notificationId, notification);
</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
index e71e74c..9e70e1b 100644
--- a/docs/html/training/wearables/notifications/stacks.jd
+++ b/docs/html/training/wearables/notifications/stacks.jd
@@ -45,7 +45,7 @@ final static String GROUP_KEY_EMAILS = "group_key_emails";
Notification notif = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender1)
.setContentText(subject1)
- .setSmallIcon(R.drawable.new_mail);
+ .setSmallIcon(R.drawable.new_mail)
.setGroup(GROUP_KEY_EMAILS)
.build();
@@ -65,7 +65,7 @@ instead of as a new card:</p>
Notification notif2 = new NotificationCompat.Builder(mContext)
.setContentTitle("New mail from " + sender2)
.setContentText(subject2)
- .setSmallIcon(R.drawable.new_mail);
+ .setSmallIcon(R.drawable.new_mail)
.setGroup(GROUP_KEY_EMAILS)
.build();
@@ -87,7 +87,7 @@ notification and call {@link android.support.v4.app.NotificationCompat.Builder#s
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>
+it appears as the only notification on the handheld device.</p>
<pre style="clear:right">
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(),
diff --git a/docs/html/training/wearables/notifications/voice-input.jd b/docs/html/training/wearables/notifications/voice-input.jd
index 4a27826..5a49343 100644
--- a/docs/html/training/wearables/notifications/voice-input.jd
+++ b/docs/html/training/wearables/notifications/voice-input.jd
@@ -37,7 +37,7 @@ so you can type replies instead.</p>
<h2 id="VoiceInput">Define the Voice Input</h2>
-<p>To create an action that supports voice input, create an instance of
+<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
@@ -86,7 +86,7 @@ style="float:right;margin:0 0 20px 40px" />
{@link android.support.v4.app.RemoteInput}:</p>
<pre>
-public static final EXTRA_VOICE_REPLY = "extra_voice_reply";
+public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
...
String replyLabel = getResources().getString(R.string.reply_label);
String[] replyChoices = getResources().getStringArray(R.array.reply_choices);
@@ -116,7 +116,7 @@ PendingIntent replyPendingIntent =
// 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))
+ getString(R.string.label), replyPendingIntent)
.addRemoteInput(remoteInput)
.build();
@@ -166,10 +166,9 @@ which is referenced by the <code>EXTRA_VOICE_REPLY</code> key that is used in th
private CharSequence getMessageText(Intent intent) {
Bundle remoteInput = RemoteInput.getResultsFromIntent(intent);
- if (remoteInput != null) {
- return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
- }
+ if (remoteInput != null) {
+ return remoteInput.getCharSequence(EXTRA_VOICE_REPLY);
}
return null;
}
-</pre> \ No newline at end of file
+</pre>
diff --git a/docs/html/training/wearables/ui/index.jd b/docs/html/training/wearables/ui/index.jd
index 8ef6fe7..5d97490 100644
--- a/docs/html/training/wearables/ui/index.jd
+++ b/docs/html/training/wearables/ui/index.jd
@@ -1,4 +1,5 @@
page.title=Creating Custom UIs for Wear Devices
+page.image=wear/images/10_uilib.png
@jd:body