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