1 2 Android XYZTouristAttractions Sample 3 =================================== 4 5 This sample aims to be as close to a real world example of a mobile 6 and Wear app combination as possible. It has a more refined design 7 and also provides a practical example of how a mobile app would 8 interact and communicate with its wear counterpart. 9 10 The app itself is modeled after a hypothetical tourist attractions 11 app that notifies the user when they are in close proximity to 12 notable points of interest. 13 14 The Wear component shows tourist attraction images and summary 15 information, and provides quick actions for nearby tourist 16 attractions in a [GridViewPager](http://developer.android.com/reference/android/support/wearable/view/GridViewPager.html) 17 UI component. 18 19 Introduction 20 ------------ 21 22 Steps for trying out this sample: 23 * Compile and install the mobile app onto your mobile device or emulator. 24 * Compile and install the wearable app onto your Wear device or emulator. 25 (**Note:** wearable apps are not automatically pushed from your mobile device 26 unless you build a production release, see [here][22] for more info). 27 * Start the mobile app and use the overflow menu options to test either a 28 notification enhanced for Wear, or the full wearable application (unless 29 you're physically in Sydney in which case the geofence should trigger 30 automatically). Note that the first time you trigger either the notification 31 or the wearable app it may take 20-30 seconds to show up as it needs to 32 transfer the image assets to the wearable (in practice this delay won't be 33 noticeable to users as they will only be notified once the data has been sent). 34 35 This sample aims to demonstrate a number of different Android APIs and concepts 36 relating to [Android Wear][1] and location using [Google Play Services][2]: 37 * Trigger a mobile notification that uses [WearableExtender][3] to customize the 38 display on the wearable 39 * Transmit data from the mobile app to the wearable (including binary blobs 40 such as photos) using the [Wearable DataApi][4] 41 * Synchronize notification dismissal across mobile and wearable apps via the 42 [Wearable MessageApi][5] 43 * Trigger actions on the mobile app via the wearable app (eg. start walking 44 navigation) via the [Wearable MessageApi][5] 45 * Locate the user via the [Google Location APIs][6] and the 46 [FusedLocationProviderApi][7] 47 * Set up and trigger location [geofences][8] using the 48 [Google Location APIs][6] 49 50 The sample also focuses on providing a simple, yet clean design and UI for both 51 mobile and wearable apps with an extra level of visual polish compared to a 52 traditional code sample. 53 54 Some of the UI widgets and design patterns used in the mobile app include: 55 * Use of Material theme including definition of primary and accent colors 56 * [AppCompat][9] usage for Material theme backward compatibility 57 * Metrics and keylines based on the [Material guidelines][10] 58 * Window content and activity transitions based on the 59 [Material guidelines][11] 60 * Use of the [RecyclerView][12] widget 61 * CoordinatorLayout[23] and FloatingActionButton[24] from the Design Support library[25] 62 * Material animations such as activity and shared element transitions 63 64 The wearable app uses a number of techniques and UI widgets as well: 65 * Full screen app built off [GridViewPager][13] and [DotsPageIndicator][14] 66 * Support for square and round screens (with and without insets) using 67 [WatchViewStub][15] and [OnApplyWindowInsetsListener][16] 68 * Use of a variety of other widgets from the [Wearable UI Library][17] 69 ([DismissOverlayView][18], [ConfirmationActivity][19], 70 [CardScrollView][20], [CircledImageView][21], [ActionPage][26]) 71 72 [1]: http://developer.android.com/wear/ 73 [2]: https://developer.android.com/google/play-services/ 74 [3]: https://developer.android.com/reference/android/support/v4/app/NotificationCompat.WearableExtender.html 75 [4]: https://developer.android.com/reference/com/google/android/gms/wearable/DataApi.html 76 [5]: https://developer.android.com/reference/com/google/android/gms/wearable/MessageApi.html 77 [6]: https://developer.android.com/google/play-services/location.html 78 [7]: https://developer.android.com/reference/com/google/android/gms/location/FusedLocationProviderApi.html 79 [8]: https://developer.android.com/reference/com/google/android/gms/location/Geofence.html 80 [9]: https://developer.android.com/tools/support-library/features.html#v7-appcompat 81 [10]: http://www.google.com/design/spec/layout/metrics-keylines.html 82 [11]: http://www.google.com/design/spec/animation/meaningful-transitions.html 83 [12]: https://developer.android.com/reference/android/support/v7/widget/RecyclerView.html 84 [13]: http://developer.android.com/reference/android/support/wearable/view/GridViewPager.html 85 [14]: http://developer.android.com/reference/android/support/wearable/view/DotsPageIndicator.html 86 [15]: http://developer.android.com/reference/android/support/wearable/view/WatchViewStub.html 87 [16]: http://developer.android.com/reference/android/view/View.OnApplyWindowInsetsListener.html 88 [17]: https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary 89 [18]: http://developer.android.com/reference/android/support/wearable/view/DismissOverlayView.html 90 [19]: http://developer.android.com/reference/android/support/wearable/activity/ConfirmationActivity.html 91 [20]: http://developer.android.com/reference/android/support/wearable/view/CardScrollView.html 92 [21]: http://developer.android.com/reference/android/support/wearable/view/CircledImageView.html 93 [22]: https://developer.android.com/training/wearables/apps/creating.html#Install 94 [23]: https://developer.android.com/reference/android/support/design/widget/CoordinatorLayout.html 95 [24]: https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.html 96 [25]: http://android-developers.blogspot.com/2015/05/android-design-support-library.html 97 [26]: http://developer.android.com/reference/android/support/wearable/view/ActionPage.html 98 99 Pre-requisites 100 -------------- 101 102 - Android SDK 23 103 - Android Build Tools v23.0.3 104 - Android Support Repository 105 106 Screenshots 107 ------------- 108 109 <img src="screenshots/composite-1.png" height="400" alt="Screenshot"/> 110 111 Getting Started 112 --------------- 113 114 This sample uses the Gradle build system. To build this project, use the 115 "gradlew build" command or use "Import Project" in Android Studio. 116 117 Support 118 ------- 119 120 - Google+ Community: https://plus.google.com/communities/105153134372062985968 121 - Stack Overflow: http://stackoverflow.com/questions/tagged/android 122 123 If you've found an error in this sample, please file an issue: 124 https://github.com/googlesamples/android-XYZTouristAttractions 125 126 Patches are encouraged, and may be submitted by forking this project and 127 submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details. 128 129 License 130 ------- 131 132 Copyright 2016 The Android Open Source Project, Inc. 133 134 Licensed to the Apache Software Foundation (ASF) under one or more contributor 135 license agreements. See the NOTICE file distributed with this work for 136 additional information regarding copyright ownership. The ASF licenses this 137 file to you under the Apache License, Version 2.0 (the "License"); you may not 138 use this file except in compliance with the License. You may obtain a copy of 139 the License at 140 141 http://www.apache.org/licenses/LICENSE-2.0 142 143 Unless required by applicable law or agreed to in writing, software 144 distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 145 WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 146 License for the specific language governing permissions and limitations under 147 the License. 148