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