1
2Android Geofencing Sample
3===================================
4
5When the user enters the vicinity of the Android building (B44) or the Yerba Buena
6Gardens near the Moscone center in San Francisco, a notification silently appears on their
7wearable with an option to check in. This notification automatically disappears when they leave
8the area, and reappears the next time they are at one of these locations.
9
10Introduction
11------------
12
13Geofencing combines awareness of the user's current location with awareness of
14nearby features, defined as the user's proximity to locations that may be of
15interest. To mark a location of interest, you specify its latitude and longitude.
16To adjust the proximity for the location, you add a radius. The latitude,
17longitude, and radius define a geofence. You can have multiple active
18geofences at one time.
19
20To use geofencing, start by defining the geofences you want to monitor.
21Although you usually store geofence data in a local database or download
22it from the network, you need to send a geofence to Location Services as
23an instance of [Geofence][2], which you create with `Geofence.Builder`. Each
24Geofence object contains the following information:
25
261. Latitude, longitude, and radius
272. Expiration time
283. Transition type
294. Geofence ID
30
31Read more about geofences in [Creating and Monitoring Geofences][1].
32
33[1]:http://developer.android.com/training/location/geofencing.html
34[2]:http://developer.android.com/reference/com/google/android/gms/location/Geofence.html
35
36Pre-requisites
37--------------
38
39- Android SDK 27
40- Android Build Tools v27.0.2
41- Android Support Repository
42
43Screenshots
44-------------
45
46<img src="screenshots/android_building_check_in.png" height="400" alt="Screenshot"/>
47
48Getting Started
49---------------
50
51This sample uses the Gradle build system. To build this project, use the
52"gradlew build" command or use "Import Project" in Android Studio.
53
54Support
55-------
56
57- Google+ Community: https://plus.google.com/communities/105153134372062985968
58- Stack Overflow: http://stackoverflow.com/questions/tagged/android
59
60If you've found an error in this sample, please file an issue:
61https://github.com/googlesamples/android-Geofencing
62
63Patches are encouraged, and may be submitted by forking this project and
64submitting a pull request through GitHub. Please see CONTRIBUTING.md for more details.
65
66License
67-------
68
69Copyright 2017 The Android Open Source Project, Inc.
70
71Licensed to the Apache Software Foundation (ASF) under one or more contributor
72license agreements.  See the NOTICE file distributed with this work for
73additional information regarding copyright ownership.  The ASF licenses this
74file to you under the Apache License, Version 2.0 (the "License"); you may not
75use this file except in compliance with the License.  You may obtain a copy of
76the License at
77
78http://www.apache.org/licenses/LICENSE-2.0
79
80Unless required by applicable law or agreed to in writing, software
81distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
82WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
83License for the specific language governing permissions and limitations under
84the License.
85