• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 Copyright 2015 Google Inc. All rights reserved.
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>XYZTouristAttractions</name>
19    <group>Wearable</group>
20    <package>com.example.android.xyztouristattractions</package>
21    <minSdk>18</minSdk>
22    <targetSdkVersion>22</targetSdkVersion>
23
24    <wearable>
25        <has_handheld_app>true</has_handheld_app>
26    </wearable>
27
28    <dependency>com.google.android.gms:play-services-location</dependency>
29    <dependency>com.google.maps.android:android-maps-utils:0.3.4</dependency>
30    <dependency>com.github.bumptech.glide:glide:3.6.0</dependency>
31    <dependency>com.android.support:appcompat-v7:22.2.0</dependency>
32    <dependency>com.android.support:recyclerview-v7:22.2.0</dependency>
33    <dependency>com.android.support:design:22.2.0</dependency>
34    <dependency_wearable>com.google.android.gms:play-services-location</dependency_wearable>
35    <dependency_shared>com.google.android.gms:play-services-wearable</dependency_shared>
36    <dependency_shared>com.google.android.gms:play-services-location</dependency_shared>
37    <dependency_shared>com.google.maps.android:android-maps-utils:0.3.4</dependency_shared>
38
39    <strings>
40        <intro>
41<![CDATA[
42This sample aims to be as close to a real world example of a mobile
43and Wear app combination as possible. It has a more refined design
44and also provides a practical example of how a mobile app would
45interact and communicate with its wear counterpart.
46
47The app itself is modeled after a hypothetical tourist attractions
48app that notifies the user when they are in close proximity to
49notable points of interest.
50
51The Wear component loads a full wearable app that shows images,
52summary information and provides quick actions for nearby tourist
53attractions in a GridViewPager UI component.
54]]>
55        </intro>
56    </strings>
57
58    <template src="base" />
59    <template src="WearPlusShared"/>
60
61    <metadata>
62        <!-- Values: {DRAFT | PUBLISHED | INTERNAL | DEPRECATED | SUPERCEDED} -->
63        <status>PUBLISHED</status>
64        <!-- See http://go/sample-categories for details on the next 4 fields. -->
65        <categories>Wearable, Location, Notification</categories>
66        <technologies>Android</technologies>
67        <languages>Java</languages>
68        <solutions>Mobile</solutions>
69        <!-- Values: {BEGINNER | INTERMEDIATE | ADVANCED | EXPERT} -->
70        <level>INTERMEDIATE</level>
71        <!-- Dimensions: 512x512, PNG fomrat -->
72        <icon>screenshots/icon-web.png</icon>
73        <!-- Path to screenshots. Use <img> tags for each. -->
74        <screenshots>
75            <img>screenshots/composite-1.png</img>
76        </screenshots>
77        <!-- List of APIs that this sample should be cross-referenced under. Use <android>
78        for fully-qualified Framework class names ("android:" namespace).
79
80        Use <ext> for custom namespaces, if needed. See "Samples Index API" documentation
81        for more details. -->
82        <api_refs>
83            <android>android.support.v7.appcompat</android>
84            <android>android.support.v7.widget.RecyclerView</android>
85            <android>android.support.v7.widget.GridLayoutManager</android>
86            <android>android.support.design.widget.FloatingActionButton</android>
87            <android>android.support.design.widget.CoordinatorLayout</android>
88            <android>com.google.android.gms.common.api.GoogleApiClient</android>
89            <android>com.google.android.gms.wearable.Wearable</android>
90            <android>com.google.android.gms.wearable.DataApi</android>
91            <android>com.google.android.gms.wearable.NodeApi</android>
92            <android>com.google.android.gms.wearable.WearableListenerService</android>
93            <android>com.google.android.gms.location.LocationServices.GeofencingApi</android>
94            <android>com.google.android.gms.location.LocationServices.FusedLocationApi</android>
95            <android>android.support.wearable.view.DismissOverlayView</android>
96            <android>android.support.wearable.view.DotsPageIndicator</android>
97            <android>android.support.wearable.view.GridViewPager</android>
98            <android>android.support.wearable.activity.ConfirmationActivity</android>
99            <android>android.support.wearable.view.CardFrame</android>
100            <android>android.support.wearable.view.CardScrollView</android>
101            <android>android.support.wearable.view.GridPagerAdapter</android>
102            <android>android.support.wearable.view.WatchViewStub</android>
103            <android>android.support.wearable.view.ActionPage</android>
104        </api_refs>
105
106        <!-- 1-3 line description of the sample here.
107
108            Avoid simply rearranging the sample's title. What does this sample actually
109            accomplish, and how does it do it? -->
110        <description>
111This sample aims to be as close to a real world example of a mobile
112and Wear app combination as possible. It has a more refined design
113and also provides a practical example of how a mobile app would
114interact and communicate with its wear counterpart.
115
116The app itself is modeled after a hypothetical tourist attractions
117app that notifies the user when they are in close proximity to
118notable points of interest.
119
120The Wear component shows tourist attraction images and summary
121information, and provides quick actions for nearby tourist
122attractions in a [GridViewPager](http://developer.android.com/reference/android/support/wearable/view/GridViewPager.html)
123UI component.
124        </description>
125
126        <!-- Multi-paragraph introduction to sample, from an educational point-of-view.
127        Makrdown formatting allowed. This will be used to generate a mini-article for the
128        sample on DAC. -->
129        <intro>
130<![CDATA[
131Steps for trying out this sample:
132* Compile and install the mobile app onto your mobile device or emulator.
133* Compile and install the wearable app onto your Wear device or emulator.
134(**Note:** wearable apps are not automatically pushed from your mobile device
135unless you build a production release, see [here][22] for more info).
136* Start the mobile app and use the overflow menu options to test either a
137notification enhanced for Wear, or the full wearable application (unless
138you're physically in Sydney in which case the geofence should trigger
139automatically). Note that the first time you trigger either the notification
140or the wearable app it may take 20-30 seconds to show up as it needs to
141transfer the image assets to the wearable (in practice this delay won't be
142noticeable to users as they will only be notified once the data has been sent).
143
144This sample aims to demonstrate a number of different Android APIs and concepts
145relating to [Android Wear][1] and location using [Google Play Services][2]:
146* Trigger a mobile notification that uses [WearableExtender][3] to customize the
147display on the wearable
148* Transmit data from the mobile app to the wearable (including binary blobs
149such as photos) using the [Wearable DataApi][4]
150* Synchronize notification dismissal across mobile and wearable apps via the
151[Wearable MessageApi][5]
152* Trigger actions on the mobile app via the wearable app (eg. start walking
153navigation) via the [Wearable MessageApi][5]
154* Locate the user via the [Google Location APIs][6] and the
155[FusedLocationProviderApi][7]
156* Set up and trigger location [geofences][8] using the
157[Google Location APIs][6]
158
159The sample also focuses on providing a simple, yet clean design and UI for both
160mobile and wearable apps with an extra level of visual polish compared to a
161traditional code sample.
162
163Some of the UI widgets and design patterns used in the mobile app include:
164* Use of Material theme including definition of primary and accent colors
165* [AppCompat][9] usage for Material theme backward compatibility
166* Metrics and keylines based on the [Material guidelines][10]
167* Window content and activity transitions based on the
168[Material guidelines][11]
169* Use of the [RecyclerView][12] widget
170* CoordinatorLayout[23] and FloatingActionButton[24] from the Design Support library[25]
171* Material animations such as activity and shared element transitions
172
173The wearable app uses a number of techniques and UI widgets as well:
174* Full screen app built off [GridViewPager][13] and [DotsPageIndicator][14]
175* Support for square and round screens (with and without insets) using
176[WatchViewStub][15] and [OnApplyWindowInsetsListener][16]
177* Use of a variety of other widgets from the [Wearable UI Library][17]
178([DismissOverlayView][18], [ConfirmationActivity][19],
179[CardScrollView][20], [CircledImageView][21], [ActionPage][26])
180
181[1]: http://developer.android.com/wear/
182[2]: https://developer.android.com/google/play-services/
183[3]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender.html
184[4]: https://developer.android.com/reference/com/google/android/gms/wearable/DataApi.html
185[5]: https://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html
186[6]: https://developer.android.com/google/play-services/location.html
187[7]: https://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html
188[8]: https://developer.android.com/reference/com/google/android/gms/location/Geofence.html
189[9]: https://developer.android.com/tools/support-library/features.html#v7-appcompat
190[10]: http://www.google.com/design/spec/layout/metrics-keylines.html
191[11]: http://www.google.com/design/spec/animation/meaningful-transitions.html
192[12]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html
193[13]: http://developer.android.com/reference/android/support/wearable/view/GridViewPager.html
194[14]: http://developer.android.com/reference/android/support/wearable/view/DotsPageIndicator.html
195[15]: http://developer.android.com/reference/android/support/wearable/view/WatchViewStub.html
196[16]: http://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener.html
197[17]: https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary
198[18]: http://developer.android.com/reference/android/support/wearable/view/DismissOverlayView.html
199[19]: http://developer.android.com/reference/android/support/wearable/activity/ConfirmationActivity.html
200[20]: http://developer.android.com/reference/android/support/wearable/view/CardScrollView.html
201[21]: http://developer.android.com/reference/android/support/wearable/view/CircledImageView.html
202[22]: https://developer.android.com/training/wearables/apps/creating.html#Install
203[23]: https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html
204[24]: https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html
205[25]: http://android-developers.blogspot.com/2015/05/android-design-support-library.html
206[26]: http://developer.android.com/reference/android/support/wearable/view/ActionPage.html
207]]>
208        </intro>
209    </metadata>
210</sample>
211