1page.title=Making Your App Location-Aware 2page.tags=location,geofence,geofencing,activity recognition,activity detection,gps 3 4trainingnavtop=true 5startpage=true 6 7 8@jd:body 9 10<div id="tb-wrapper"> 11<div id="tb"> 12 13<!-- Required platform, tools, add-ons, devices, knowledge, etc. --> 14<h2>Dependencies and prerequisites</h2> 15<ul> 16 <li>Google Play services client library (latest version)</li> 17 <li>Android version 2.2 (API level 8) or later</li> 18</ul> 19 20<!-- related docs (NOT javadocs) --> 21<h2>You should also read</h2> 22<ul> 23 <li> 24 <a href="{@docRoot}google/play-services/setup.html">Set Up Google Play 25 Services SDK</a> 26 </li> 27</ul> 28 29</div> 30</div> 31 32<a class="notice-developers-video wide" 33href="https://www.youtube.com/watch?v=S8sugXgUVEI"> 34<div> 35 <h3>Video</h3> 36 <p>Activity Recognition</p> 37 </div> 38 </a> 39 40<p> 41 One of the unique features of mobile applications is location awareness. 42 Mobile users take their devices with them everywhere, and adding location 43 awareness to your app offers users a more contextual experience. The location 44 APIs available in Google Play services facilitate adding location awareness to 45 your app with automated location tracking, geofencing, and activity 46 recognition. 47</p> 48 49<p>The 50 <a href="{@docRoot}reference/com/google/android/gms/location/package-summary.html">Google 51 Play services location APIs</a> are preferred over the Android framework 52 location APIs 53 (<a href="{@docRoot}reference/android/location/package-summary.html">android.location</a>) 54 as a way of adding location awareness to your app. If you are currently using 55 the Android framework location APIs, you are strongly encouraged to switch to 56 the Google Play services location APIs as soon as possible. 57</p> 58 59<p> 60 This class shows you how to use the Google Play services location APIs in your 61 app to get the current location, get periodic location updates, and look up 62 addresses. The class includes sample apps and code snippets that you can use as a starting point 63 for adding location awareness to your app. 64</p> 65 66<p class="note"> 67 <strong>Note:</strong> Since this class is based on the Google Play services 68 client library, make sure you install the latest version before using the 69 sample apps or code snippets. To learn how to set up the client library with 70 the latest version, see 71 <a href="{@docRoot}google/play-services/setup.html">Setup</a> in the Google 72 Play services guide. 73</p> 74<h2>Lessons</h2> 75<dl> 76 <dt> 77 <b><a href="retrieve-current.html">Getting the Last Known Location</a></b> 78 </dt> <dd> 79 Learn how to retrieve the last known location of an Android device, which 80 is usually equivalent to the user's current location. 81 </dd> <dt> 82 <b><a href="change-location-settings.html">Changing Location Settings</a></b> 83 <dt> <dd> 84 Learn how to detect and apply system settings for location features. 85 </dd> <dt> 86 <b><a href="receive-location-updates.html">Receiving Location 87 Updates</a></b> 88 </dt> <dd> 89 Learn how to request and receive periodic location updates. 90 </dd> <dt> 91 <b><a href="display-address.html">Displaying a Location Address</a></b> 92 </dt> <dd> 93 Learn how to convert a location's latitude and longitude into an address 94 (reverse geocoding). 95 </dd> 96 <dt> 97 <b><a href="geofencing.html">Creating and Monitoring Geofences</a></b> 98 </dt> <dd> 99 Learn how to define one or more geographic areas as locations of interest, 100 called geofences, and detect when the user is close to or inside a geofence. 101 </dd> 102</dl> 103