Login     Sign Up
Tugadar (@admin)
21 days ago

One of the defi ning features of mobile phones is their portability, so it’s not surprising that some

of the most enticing Android features are the services that let you find, contextualize, and map physical locations.

You can create map-based Activities using Google Maps as a User Interface element. You have full access to the map, allowing you to control display settings, alter the zoom level, and move the centered location. Using Overlays, you can annotate maps and handle user input to provide mapcontextualized information and functionality.

Also covered in this chapter are the location-based services (LBS) — the services that let you find the device’s current location. They include technologies like GPS and Google’s cell-based location technology. You can specify which location-sensing technology to use explicitly by name, or implicitly by defi ning a set of criteria in terms of accuracy, cost, and other requirements.

Maps and location-based services use latitude and longitude to pinpoint geographic locations,

but your users are more likely to think in terms of an address. Android provides a Geocoder that supports forward and reverse geocoding. Using the Geocoder, you can convert back and forth

between latitude/longitude values and real-world addresses.

Used together, the mapping, geocoding, and location-based services provide a powerful toolkit

for incorporating your phone’s native mobility into your mobile applications.

In this chapter, you’ll learn to:

Set up your emulator to test location-based services.

Find and track the device location.

Create proximity alerts.

Turn geographical locations into street addresses and vice versa.

Create and customize map-based Activities using MapView and MapActivity.

Add Overlays to your maps.

Using Location-Bas