Skip to content

Commit

Permalink
Update datalayer docs with capability setup step. Add capability to s…
Browse files Browse the repository at this point in the history
…ample apps. (#1908)
  • Loading branch information
luizgrp authored Dec 20, 2023
1 parent 1dd60b3 commit 79d944c
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 20 deletions.
9 changes: 0 additions & 9 deletions datalayer/phone/src/res/values/wear.xml

This file was deleted.

4 changes: 3 additions & 1 deletion datalayer/sample/phone/src/main/res/values/wear.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
name="android_wear_capabilities"
translatable="false"
tools:ignore="UnusedResources">
<!-- declaring the provided capabilities -->
<!-- Used to indicate that the app is installed on this device -->
<item>data_layer_app_helper_device_phone</item>
<!-- Used to indicate the device is a phone -->
<item>horologist_phone</item>
</string-array>
</resources>
24 changes: 24 additions & 0 deletions datalayer/sample/wear/src/main/res/values/wear.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright 2023 The Android Open Source Project
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ https://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<resources>
<string-array name="android_wear_capabilities">
<!-- Used to indicate that the app is installed on this device -->
<item>data_layer_app_helper_device_watch</item>
<!-- Used to indicate the device is a watch -->
<item>horologist_watch</item>
</string-array>
</resources>
9 changes: 0 additions & 9 deletions datalayer/watch/src/main/res/values/wear.xml

This file was deleted.

6 changes: 5 additions & 1 deletion docs/auth-tokenshare-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,16 @@ your phone and watch apps must:
content:
```xml
<resources>
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@array/android_wear_capabilities">
<string-array name="android_wear_capabilities">
<item>horologist_phone</item>
</string-array>
</resources>
```
For more details, see
[Specify capability names for detecting your apps](https://developer.android.com/training/wearables/apps/standalone-apps#capability-names).
1. Create a `WearDataLayerRegistry`
Expand Down
29 changes: 29 additions & 0 deletions docs/datalayer-helpers-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,35 @@ phone.
For your watch and phone projects respectively.
1. Add the capability
Add a `wear.xml` file in the `res/values` folder with the following content:
```xml
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@array/android_wear_capabilities">
<string-array name="android_wear_capabilities">
<item>data_layer_app_helper_device_watch</item>
</string-array>
</resources>
```
and
```xml
<resources xmlns:tools="http://schemas.android.com/tools"
tools:keep="@array/android_wear_capabilities">
<string-array name="android_wear_capabilities">
<item>data_layer_app_helper_device_phone</item>
</string-array>
</resources>
```
On your watch and phone projects respectively.
For more details, see
[Specify capability names for detecting your apps](https://developer.android.com/training/wearables/apps/standalone-apps#capability-names).
1. Initialize the client, including passing a `WearDataLayerRegistry`.
```kotlin
Expand Down

0 comments on commit 79d944c

Please sign in to comment.