Home | History | Annotate | Download | only in location
      1 page.title=Location and Maps
      2 excludeFromSuggestions=true
      3 @jd:body
      4 
      5 <div id="qv-wrapper">
      6 <div id="qv">
      7 
      8 <h2>In this document</h2>
      9   <ol>
     10     <li><a href="#location">Location Services</a></li>
     11     <li><a href="#maps">Google Maps Android API</a></li>
     12   </ol>
     13 
     14 </div>
     15 </div>
     16 <div class="note">
     17 <p>
     18     <strong>Note:</strong> This is a guide to the <i>Android framework</i> location APIs in the
     19     package {@link android.location}. The Google Location Services API, part of Google Play
     20     Services, provides a more powerful, high-level framework that automates tasks such as
     21     location provider choice and power management. Location Services also provides new
     22     features such as activity detection that aren't available in the framework API. Developers who
     23     are using the framework API, as well as developers who are just now adding location-awareness
     24     to their apps, should strongly consider using the Location Services API.
     25 </p>
     26 <p>
     27     To learn more about the Location Services API, see
     28     <a href="{@docRoot}google/play-services/location.html">Google Location Services for Android</a>.
     29 </p>
     30 </div>
     31 <p>
     32     Location and maps-based apps offer a compelling experience on mobile devices. You
     33     can build these capabilities into your app using the classes of the {@link
     34     android.location} package and the Google Maps Android API. The sections below provide
     35     an introduction to how you can add the features.
     36 </p>
     37 
     38 <h2 id="location">Location Services</h2>
     39 
     40 <p>Android gives your applications access to the location services supported by
     41 the device through classes in the {@code android.location} package. The
     42 central component of the location framework is the
     43 {@link android.location.LocationManager} system service, which provides APIs to
     44 determine location and bearing of the underlying device (if available). </p>
     45 
     46 <p>As with other system services, you do not instantiate a {@link android.location.LocationManager}
     47 directly. Rather, you request an instance from the system by calling
     48 {@link android.content.Context#getSystemService(String)
     49 getSystemService(Context.LOCATION_SERVICE)}. The method returns a handle to a new {@link
     50 android.location.LocationManager} instance.</p>
     51 
     52 <p>Once your application has a {@link android.location.LocationManager}, your application
     53 is able to do three things:</p>
     54 
     55 <ul>
     56     <li>Query for the list of all {@link android.location.LocationProvider}s for the last known
     57 user location.</li>
     58     <li>Register/unregister for periodic updates of the user's current location from a
     59     location provider (specified either by criteria or name).</li>
     60     <li>Register/unregister for a given {@link android.content.Intent} to be fired if the device
     61 comes within a given proximity (specified by radius in meters) of a given lat/long.</li>
     62 </ul>
     63 
     64 <p>For more information about acquiring the user location, read the <a
     65 href="{@docRoot}guide/topics/location/strategies.html">Location Strategies</a> guide.</p>
     66 
     67 
     68 
     69 <h2 id="maps">Google Maps Android API</h2>
     70 
     71 <p>With the
     72 <a href="http://developers.google.com/maps/documentation/android/">Google Maps Android API</a>,
     73 you can add maps to your app that are based on Google
     74 Maps data. The API automatically handles access to Google Maps servers, data downloading,
     75 map display, and touch gestures on the map. You can also use API calls to add markers,
     76 polygons and overlays, and to change the user's view of a particular map area.</p>
     77 
     78 <p>The key class in the Google Maps Android API is
     79 <a href="{@docRoot}reference/com/google/android/gms/maps/MapView.html">{@code MapView}</a>.
     80 A <a href="{@docRoot}reference/com/google/android/gms/maps/MapView.html">{@code MapView}</a>
     81 displays a map with data obtained
     82 from the Google Maps service. When the
     83 <a href="{@docRoot}reference/com/google/android/gms/maps/MapView.html">{@code MapView}</a>
     84 has focus, it will capture
     85 keypresses and touch gestures to pan and zoom the map automatically, including
     86 handling network requests for additional maps tiles. It also provides all of the
     87 UI elements necessary for users to control the map. Your application can also
     88 use <a href="{@docRoot}reference/com/google/android/gms/maps/MapView.html">{@code MapView}</a>
     89 class methods to control the map programmatically and draw a
     90 number of overlays on top of the map. </p>
     91 
     92 <p>The Google Maps Android APIs are not included in the Android platform,
     93 but are available on any device
     94 with the Google Play Store running Android 2.2 or higher, through
     95 <a href="{@docRoot}google/play-services/index.html">Google Play services</a>.</p>
     96 
     97 <p>To integrate Google Maps into your app, you need to install the Google Play services
     98 libraries for your Android SDK. For more details, read about <a
     99 href="{@docRoot}google/play-services/maps.html">Google Play services</a>.</p>
    100 
    101 
    102