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