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 ...

Get Android Programming: The Big Nerd Ranch Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.