O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Locations and the LocationManager

With the foundation in place, now you can get to work on the inside of the house. Location data in Android is provided by the LocationManager system service. This service provides location updates to all applications who are interested in them, and it delivers those updates in one of two ways.

The first, and perhaps most straightforward, way is via the LocationListener interface. This interface gives you information about location updates (via onLocationChanged(Location)) as well as status updates and notifications that the provider has been enabled or disabled.

Using LocationListener to get updates is a fine thing to do when you only need the location data to come to a single component in your application. For ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required