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