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