# Print output for @column tags ?>
public
interface
LocationListener
| android.location.LocationListener |
Used for receiving notifications when the device location has changed. These methods are called when the listener has been registered with the LocationManager.
For more information about identifying user location, read the Obtaining User Location developer guide.
See also:
Public methods | |
|---|---|
default
void
|
onFlushComplete(int requestCode)
Invoked when a flush operation is complete and after flushed locations have been delivered. |
default
void
|
onLocationChanged(List<Location> locations)
Called when the location has changed and locations are being delivered in batches. |
abstract
void
|
onLocationChanged(Location location)
Called when the location has changed. |
default
void
|
onProviderDisabled(String provider)
Called when the provider this listener is registered with becomes disabled. |
default
void
|
onProviderEnabled(String provider)
Called when a provider this listener is registered with becomes enabled. |
default
void
|
onStatusChanged(String provider, int status, Bundle extras)
This method is deprecated. This callback will never be invoked on Android Q and above. |
public void onFlushComplete (int requestCode)
Invoked when a flush operation is complete and after flushed locations have been delivered.
| Parameters | |
|---|---|
requestCode |
int: the request code passed into
LocationManager#requestFlush(String, LocationListener, int) |
public void onLocationChanged (List<Location> locations)
Called when the location has changed and locations are being delivered in batches. The
default implementation calls through to onLocationChanged(android.location.Location) with all
locations in the batch. The list of locations is always guaranteed to be non-empty, and is
always guaranteed to be ordered from earliest location to latest location (so that the
earliest location in the batch is at index 0 in the list, and the latest location in the
batch is at index size-1 in the list).
| Parameters | |
|---|---|
locations |
List: the location list
This value cannot be null. |
public abstract void onLocationChanged (Location location)
Called when the location has changed. A wakelock may be held on behalf on the listener for some brief amount of time as this callback executes. If this callback performs long running operations, it is the client's responsibility to obtain their own wakelock if necessary.
| Parameters | |
|---|---|
location |
Location: the updated location
This value cannot be null. |
public void onProviderDisabled (String provider)
Called when the provider this listener is registered with becomes disabled. If a provider is disabled when this listener is registered, this callback will be invoked immediately.
Note that this method only has a default implementation on Android R and above, and this method must still be overridden in order to run successfully on Android versions below R. LocationListenerCompat from the compat libraries may be used to avoid the need to override for older platforms.
| Parameters | |
|---|---|
provider |
String: the name of the location provider
This value cannot be null. |
public void onProviderEnabled (String provider)
Called when a provider this listener is registered with becomes enabled.
Note that this method only has a default implementation on Android R and above, and this method must still be overridden in order to run successfully on Android versions below R. LocationListenerCompat from the compat libraries may be used to avoid the need to override for older platforms.
| Parameters | |
|---|---|
provider |
String: the name of the location provider
This value cannot be null. |
public void onStatusChanged (String provider, int status, Bundle extras)
This method is deprecated.
This callback will never be invoked on Android Q and above.
This callback will never be invoked on Android Q and above, and providers can be considered
as always in the LocationProvider#AVAILABLE state.
Note that this method only has a default implementation on Android R and above, and this method must still be overridden in order to run successfully on Android versions below R. LocationListenerCompat from the compat libraries may be used to avoid the need to override for older platforms.
| Parameters | |
|---|---|
provider |
String |
status |
int |
extras |
Bundle |