docs: Fix companion configuration (18864041)
Fix declaration of var and incorrect method call (18617393) bug: 18864041 bug: 18617393 Change-Id: Ic31e44acfe7338f56acdbbd97ba8cc1e87042b53
This commit is contained in:
@@ -39,16 +39,24 @@ to Google Play services and when to use each in
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
Node node; // the connected device to send the message to
|
|
||||||
GoogleApiClient mGoogleApiClient;
|
GoogleApiClient mGoogleApiClient;
|
||||||
public static final START_ACTIVITY_PATH = "/start/MainActivity";
|
public static final String START_ACTIVITY_PATH = "/start/MainActivity";
|
||||||
...
|
...
|
||||||
|
|
||||||
SendMessageResult result = Wearable.MessageApi.sendMessage(
|
private void sendStartActivityMessage(String nodeId) {
|
||||||
mGoogleApiClient, node, START_ACTIVITY_PATH, null).await();
|
Wearable.MessageApi.sendMessage(
|
||||||
if (!result.getStatus().isSuccess()) {
|
mGoogleApiClient, nodeId, START_ACTIVITY_PATH, new byte[0]).setResultCallback(
|
||||||
Log.e(TAG, "ERROR: failed to send Message: " + result.getStatus());
|
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());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ and declare the following intent filter in the manifest file of the wearable app
|
|||||||
<action android:name=
|
<action android:name=
|
||||||
"com.example.android.wearable.watchface.CONFIG_DIGITAL" />
|
"com.example.android.wearable.watchface.CONFIG_DIGITAL" />
|
||||||
<category android:name=
|
<category android:name=
|
||||||
"com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION" />
|
<strong>"com.google.android.wearable.watchface.category.WEARABLE_CONFIGURATION"</strong> />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</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.</p>
|
present users with elaborate color pickers to select the background color of a watch face.</p>
|
||||||
|
|
||||||
<p>To create a companion configuration activity, add a new activity to your handheld app module and
|
<p>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 <a href="#WearableActivity">Create
|
declare the following intent filter in the manifest file of the handheld app:</p>
|
||||||
a Wearable Configuration Activity</a>.</p>
|
|
||||||
|
<pre>
|
||||||
|
<activity
|
||||||
|
android:name=".DigitalWatchFaceCompanionConfigActivity"
|
||||||
|
android:label="@string/app_name">
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name=
|
||||||
|
"com.example.android.wearable.watchface.CONFIG_DIGITAL" />
|
||||||
|
<category android:name=
|
||||||
|
<strong>"com.google.android.wearable.watchface.category.COMPANION_CONFIGURATION"</strong> />
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
</pre>
|
||||||
|
|
||||||
<p>In your configuration activity, build a UI that provides options to customize all the
|
<p>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 <a
|
configurable elements of your watch face. When users make a selection, use the <a
|
||||||
|
|||||||
Reference in New Issue
Block a user