From 1dd76ea2760f84496a5b82435fc35d7c28a6dd6d Mon Sep 17 00:00:00 2001 From: Luan Nguyen Date: Wed, 21 Jan 2015 15:16:36 -0800 Subject: [PATCH] docs: Fix companion configuration (18864041) Fix declaration of var and incorrect method call (18617393) bug: 18864041 bug: 18617393 Change-Id: Ic31e44acfe7338f56acdbbd97ba8cc1e87042b53 --- .../training/wearables/data-layer/messages.jd | 22 +++++++++++++------ .../wearables/watch-faces/configuration.jd | 19 +++++++++++++--- 2 files changed, 31 insertions(+), 10 deletions(-) diff --git a/docs/html/training/wearables/data-layer/messages.jd b/docs/html/training/wearables/data-layer/messages.jd index 822e395b11218..0ca55ba66c63e 100644 --- a/docs/html/training/wearables/data-layer/messages.jd +++ b/docs/html/training/wearables/data-layer/messages.jd @@ -39,16 +39,24 @@ to Google Play services and when to use each in

-Node node; // the connected device to send the message to
 GoogleApiClient mGoogleApiClient;
-public static final START_ACTIVITY_PATH = "/start/MainActivity";
+public static final String 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());
-    }
+private void sendStartActivityMessage(String nodeId) {
+    Wearable.MessageApi.sendMessage(
+      mGoogleApiClient, nodeId, START_ACTIVITY_PATH, new byte[0]).setResultCallback(
+          new ResultCallback<SendMessageResult>() {
+              @Override
+              public void onResult(SendMessageResult sendMessageResult) {
+                  if (!sendMessageResult.getStatus().isSuccess()) {
+                      Log.e(TAG, "Failed to send message with status code: "
+                              + sendMessageResult.getStatus().getStatusCode());
+                  }
+              }
+          }
+      );
+}
 

diff --git a/docs/html/training/wearables/watch-faces/configuration.jd b/docs/html/training/wearables/watch-faces/configuration.jd index edc7eac54f65f..5a4585d5e597b 100644 --- a/docs/html/training/wearables/watch-faces/configuration.jd +++ b/docs/html/training/wearables/watch-faces/configuration.jd @@ -92,7 +92,7 @@ and declare the following intent filter in the manifest file of the wearable app <action android:name= "com.example.android.wearable.watchface.CONFIG_DIGITAL" /> <category android:name= - "com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" /> + "com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> @@ -119,8 +119,21 @@ a handheld device. For example, a configuration activity on a handheld device en present users with elaborate color pickers to select the background color of a watch face.

To create a companion configuration activity, add a new activity to your handheld app module and -declare the same intent filter for this activity as the one in Create -a Wearable Configuration Activity.

+declare the following intent filter in the manifest file of the handheld app:

+ +
+<activity
+    android:name=".DigitalWatchFaceCompanionConfigActivity"
+    android:label="@string/app_name">
+    <intent-filter>
+        <action android:name=
+            "com.example.android.wearable.watchface.CONFIG_DIGITAL" />
+        <category android:name=
+        "com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION" />
+        <category android:name="android.intent.category.DEFAULT" />
+    </intent-filter>
+</activity>
+

In your configuration activity, build a UI that provides options to customize all the configurable elements of your watch face. When users make a selection, use the