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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.