README.md
1
2Android XYZTouristAttractions Sample
3===================================
4
5This sample aims to be as close to a real world example of a mobile
6and Wear app combination as possible. It has a more refined design
7and also provides a practical example of how a mobile app would
8interact and communicate with its wear counterpart.
9
10The app itself is modeled after a hypothetical tourist attractions
11app that notifies the user when they are in close proximity to
12notable points of interest.
13
14The Wear component shows tourist attraction images and summary
15information, and provides quick actions for nearby tourist
16attractions in a [GridViewPager](http://developer.android.com/reference/android/support/wearable/view/GridViewPager.html)
17UI component.
18
19Introduction
20------------
21
22Steps 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
26unless 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
28notification enhanced for Wear, or the full wearable application (unless
29you're physically in Sydney in which case the geofence should trigger
30automatically). Note that the first time you trigger either the notification
31or the wearable app it may take 20-30 seconds to show up as it needs to
32transfer the image assets to the wearable (in practice this delay won't be
33noticeable to users as they will only be notified once the data has been sent).
34
35This sample aims to demonstrate a number of different Android APIs and concepts
36relating to [Android Wear][1] and location using [Google Play Services][2]:
37* Trigger a mobile notification that uses [WearableExtender][3] to customize the
38display on the wearable
39* Transmit data from the mobile app to the wearable (including binary blobs
40such 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
44navigation) 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
50The sample also focuses on providing a simple, yet clean design and UI for both
51mobile and wearable apps with an extra level of visual polish compared to a
52traditional code sample.
53
54Some 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
64The 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
99Pre-requisites
100--------------
101
102- Android SDK 27
103- Android Build Tools v27.0.2
104- Android Support Repository
105
106Screenshots
107-------------
108
109<img src="screenshots/composite-1.png" height="400" alt="Screenshot"/>
110
111Getting Started
112---------------
113
114This sample uses the Gradle build system. To build this project, use the
115"gradlew build" command or use "Import Project" in Android Studio.
116
117Support
118-------
119
120- Google+ Community: https://plus.google.com/communities/105153134372062985968
121- Stack Overflow: http://stackoverflow.com/questions/tagged/android
122
123If you've found an error in this sample, please file an issue:
124https://github.com/googlesamples/android-XYZTouristAttractions
125
126Patches are encouraged, and may be submitted by forking this project and
127submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
128
129License
130-------
131
132Copyright 2017 The Android Open Source Project, Inc.
133
134Licensed to the Apache Software Foundation (ASF) under one or more contributor
135license agreements. See the NOTICE file distributed with this work for
136additional information regarding copyright ownership. The ASF licenses this
137file to you under the Apache License, Version 2.0 (the "License"); you may not
138use this file except in compliance with the License. You may obtain a copy of
139the License at
140
141http://www.apache.org/licenses/LICENSE-2.0
142
143Unless required by applicable law or agreed to in writing, software
144distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
145WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
146License for the specific language governing permissions and limitations under
147the License.
148