• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2013 The Android Open Source Project
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9     http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16-->
17<sample>
18    <name>AlwaysOn</name>
19    <group>Wearable</group>
20    <package>com.example.android.wearable.wear.alwayson</package>
21
22    <multiDexEnabled>true</multiDexEnabled>
23
24    <androidX>true</androidX>
25
26    <dependency_wearable>androidx.wear:wear:1.0.0</dependency_wearable>
27
28    <dependency_wearable>androidx.legacy:legacy-support-v13:1.0.0</dependency_wearable>
29
30    <strings>
31        <intro>
32            <![CDATA[
33            Demonstrates a native Wear app using ambient screen support.
34            ]]>>
35        </intro>
36    </strings>
37
38    <template src="base-build" />
39    <template src="Wear" />
40
41    <!-- Include common code modules by uncommenting them below. -->
42    <!-- common src="logger"/ -->
43
44    <metadata>
45        <status>PUBLISHED</status>
46        <categories>Wearable</categories>
47        <technologies>Android</technologies>
48        <languages>Java</languages>
49        <solutions>Mobile</solutions>
50        <level>INTERMEDIATE</level>
51        <screenshots>
52            <img>screenshots/1-main-active.png</img>
53            <img>screenshots/2-main-ambient.png</img>
54            <img>screenshots/3-main-active-round.png</img>
55            <img>screenshots/4-main-ambient-round.png</img>
56        </screenshots>
57        <api_refs>
58            <android>android.support.wearable.activity.WearableActivity</android>
59        </api_refs>
60        <description>
61            <![CDATA[
62A basic sample showing how to support ambient mode for native Wear apps.
63]]>
64        </description>
65
66        <intro>
67            <![CDATA[
68[WearableActivity][1] offers methods for supporting your native app staying on the screen when the Wear device enters ambient mode.
69
70This example extends [WearableActivity][1] and overrides onEnterAmbient, onUpdateAmbient, and onExitAmbient to allow the simple native Wear app to support ambient mode.
71
72In ambient mode, this app follows best practices by keeping most pixels black, avoiding large blocks of white pixels, using only black and white, and disabling anti-aliasing (following the [design guidelines for Watch Faces][2]).
73
74In addition and most importantly, the app sleeps while in ambient mode for 20 seconds between any updates to conserving battery life (processor allowed to sleep). If you can hold off on updates for a full minute, you can throw away the Handler and just use onUpdateAmbient to save even more battery life.
75
76As always, you will still want to apply the [performance guidelines][3] outlined in the Watch Faces documention to your app.
77
78[1]: http://developer.android.com/reference/android/support/wearable/activity/WearableActivity.html
79[2]: https://developer.android.com/training/wearables/watch-faces/designing.html#DesignGuidelines
80[3]: https://developer.android.com/training/wearables/watch-faces/performance.html
81]]>
82        </intro>
83    </metadata>
84</sample>
85