summaryrefslogtreecommitdiffstats
path: root/docs/html/training/wearables/data-layer/messages.jd
diff options
context:
space:
mode:
authorRicardo Cervera <rcervera@google.com>2014-10-20 14:29:42 -0700
committerRicardo Cervera-Navarro <rcervera@google.com>2014-11-20 19:51:25 +0000
commit25bf00bceed5b22f8750e68a45beb944a80773a8 (patch)
tree7da0f8f2768471d0643acd50a9ef4f243db849f0 /docs/html/training/wearables/data-layer/messages.jd
parent05282133c7491fd2b5e8f3da05408ff0165df526 (diff)
downloadframeworks_base-25bf00bceed5b22f8750e68a45beb944a80773a8.zip
frameworks_base-25bf00bceed5b22f8750e68a45beb944a80773a8.tar.gz
frameworks_base-25bf00bceed5b22f8750e68a45beb944a80773a8.tar.bz2
docs: Fixes to the Data Layer Wear class.
Bug: 17917638 Bug: 17917145 Bug: 17931937 Bug: 17933032 Bug: 16899307 Change-Id: Iee9fd0a44cd40b9860cf242cbdaabac409882a15 (cherry picked from commit eff209d2c40221d2f9be2fd6b0c9cde51dd5362b)
Diffstat (limited to 'docs/html/training/wearables/data-layer/messages.jd')
-rw-r--r--docs/html/training/wearables/data-layer/messages.jd34
1 files changed, 17 insertions, 17 deletions
diff --git a/docs/html/training/wearables/data-layer/messages.jd b/docs/html/training/wearables/data-layer/messages.jd
index b3afacb..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,
-and 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#Listen">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