This article translated from: http://developer.android.com/guide/topics/location/index.html
Location and map-based applications are the most attractive for mobile users. You can use the Android. Location package and Google map external class libraries to build these capabilities into your applications.
Location service
Android provides the location service supported by the device to your application through the class in the Android. Location package. The core component of the location framework is the locationmanager System Service, which provides APIs to determine the location and device location (if valid ).
Like other system services, you do not need to instantiate locationmanager directly. Instead, you can apply for an instance from the system by calling the getsystemservice (context. location_service) method. This method returns the handle of a new locationmanager instance.
Once your application has the locationmanager object, your application can do the following three things:
1. query the list of all locationprovider objects with the most user location;
2. Register/deregister the periodic updates of the current user location from the location provider (either by rule or by name)
3. Intent object to be triggered when the registered/deregistered device is close to the given latitude and longitude (radius area in meters.
For more information, see location policy guide.
Google map external class library
To make it easier for you to add powerful map capabilities to your application, Google provides an external map class library that is included in the com. Google. Android. Maps package. The class in this package provides built-in download, rendering, and question graph title caching functions, as well as various display options and controls.
The key class of this map package is com. Google. Android. Maps. Mayview, which is a subclass of viewgroup. Mapview displays a map with data obtained from the Google Maps service. When the mapview has a focus, it captures buttons and touch gestures to automatically translate and zoom the map, including processing additional network requests for obtaining the map title. It also provides all the UI elements required for the user to control the map. Your application can also use the mapview class method to program and control mapview, and draw some overlapping types on the map.
Generally, the mapview class provides an encapsulation around the Google Maps API, allowing your applications to maintain Google Maps data through these encapsulation methods. It also allows you to work with other types of views.
This map external class library is not part of the standard Android class library, so it may not exist on compatible Android devices. Similarly, the external map class library is not included in the standard Android class library provided by the SDK. Therefore, you can use Com. google. android. the class in the maps package for development.
To learn more about external map class libraries and how to download and use Google APIs add-on, visit the following website:
Http://code.google.com/android/add-ons/google-apis
For your convenience, Google APIs add-on can be downloaded through the android SDK manager.
Note: To display Google Maps data in mapview, you must register the Google Maps service and obtain a map API key. For more information, see How to obtain maps.
API key