# Print output for @column tags ?> LocationListener - Android SDK | Android Developers

Most visited

Recently visited

LocationListener

public interface LocationListener

android.location.LocationListener


Used for receiving notifications from the LocationManager when the location has changed. These methods are called if the LocationListener has been registered with the location manager service using the LocationManager#requestLocationUpdates(String, long, float, LocationListener) method.

Developer Guides

For more information about identifying user location, read the Obtaining User Location developer guide.

Summary

Public methods

abstract void onLocationChanged(Location location)

Called when the location has changed.

default void onProviderDisabled(String provider)

Called when the provider is disabled by the user.

default void onProviderEnabled(String provider)

Called when the provider is enabled by the user.

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 methods

onLocationChanged

public abstract void onLocationChanged (Location location)

Called when the location has changed.

Parameters
location Location: the updated location This value cannot be null.

onProviderDisabled

public void onProviderDisabled (String provider)

Called when the provider is disabled by the user. If requestLocationUpdates is called on an already disabled provider, this method is called immediately.

Parameters
provider String: the name of the location provider that has become disabled This value cannot be null.

onProviderEnabled

public void onProviderEnabled (String provider)

Called when the provider is enabled by the user.

Parameters
provider String: the name of the location provider that has become enabled This value cannot be null.

onStatusChanged

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.

Parameters
provider String

status int

extras Bundle