Preface
This chapter is about android. location. locationListener, for GPS related chapter, version for Android 3.2 r1, translated from "pandatv 82", welcome to visit his blog: "http://wisekingokok.cnblogs.com", thanks again "pandatv 82 "! Welcome to join in Android Chinese translation, contact me over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://goo.gl/6vJQl
LocationListener
Translator's signature: pandatv 82
Link: http://wisekingokok.cnblogs.com
Version: Android 3.2 r1
Structure
Inheritance relationship
Public interface LocationListener
Android. location. LocationListener
Class Overview
It is used to receive notifications when the location from the LocationManager changes. If the LocationListener is registered and added to the LocationManager object, and the LocationManager object calls the requestLocationUpdates (String, long, float, LocationListener) method, the related methods in the interface will be called
Common Methods
Public abstract voidOnLocationChanged(Location location)
This method is called when the location changes. The Location object can be used without restrictions.
Parameters
The new location after the location changes.
Public abstract voidOnProviderDisabled(String provider)
This method is called after the provider is disabled by the user. If the requestLocationUpdates method called based on a closed provider is called, this method is called.
Parameters
The name of the location provider associated with it.
Public abstract voidOnPorviderEnabled(Location location)
This method is called after the provider is enabled by the user.
Parameters
The name of the location provider associated with the provider.
Public abstract voidOnStatusChanged(String provider, int Status, Bundle extras)
This method is called when the Provider status is directly switched to the available, temporarily unavailable, or no-service status.
Parameters
The location provider name related to the change.
Status: if the service is stopped and does not change in a short period of time, the status code is OUT_OF_SERVICE. if the service is temporarily stopped and will be restored within a short period of time, the status code is TEMPORARILY_UNAVAILABLE; if the service is valid, the status code is AVAILABLE.
Extras is an optional set of parameters that contain the specific status of the provider. The following lists a group of common key-value pairs. In fact, the value that any key provider needs to provide. • Positioning satellites-a group of satellites used for device Positioning