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