Use sensors on the device to add rich location and motion capabilities to your app, from GPS or network location to accelerometer, gyroscope, temperature, barometer, and more.
> This is a guide to the Android framework location APIs in the package android.location
. You can build these capabilities into your app using the classes of the android.location
package and the Google Maps Android API.
As with other system services, you do not instantiate a LocationManager
directly. Rather, you request an instance from the system by calling getSystemService(Context.LOCATION_SERVICE)
.
> Once your application has a LocationManager
, your application is able to do three things:
- Query for the list of all
LocationProvider
s for the last known user location. - Register/unregister for periodic updates of the user's current location from a location provider (specified either by criteria or name).
- Register/unregister for a given
Intent
to be fired if the device comes within a given proximity (specified by radius in meters) of a given lat/long.