Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/location/LocationManager#constants) \| [Methods](https://developer.android.com/reference/android/location/LocationManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/location/LocationManager#inhmethods)

# LocationManager

*** ** * ** ***

` public class LocationManager `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.location.LocationManager |

<br />

*** ** * ** ***

This class provides access to the system location services. These services allow applications to obtain periodic updates of the device's geographical location, or to be notified when the device enters the proximity of a given geographical location.

Unless otherwise noted, all Location API methods require the `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permissions. If your application only has the coarse permission then providers will still return location results, but the exact location will be obfuscated to a coarse level of accuracy.   

Requires the `https://developer.android.com/reference/android/content/pm/PackageManager#FEATURE_LOCATION` feature which can be detected using `https://developer.android.com/reference/android/content/pm/PackageManager#hasSystemFeature(java.lang.String)`.

## Summary

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#ACTION_GNSS_CAPABILITIES_CHANGED` Broadcast intent action when GNSS capabilities change. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#EXTRA_GNSS_CAPABILITIES` Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#ACTION_GNSS_CAPABILITIES_CHANGED` broadcasts, containing the new `https://developer.android.com/reference/android/location/GnssCapabilities`. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#EXTRA_LOCATION_ENABLED` Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION` broadcasts, containing the boolean enabled state of location. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_ENABLED` Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION` broadcasts, containing the boolean enabled state of the location provider that has changed. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_NAME` Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION` broadcasts, containing the name of the location provider that has changed. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER` Standard name of the fused location provider. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` Standard name of the GNSS location provider. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_FLUSH_COMPLETE` Key used for an extra holding an integer request code when location flush completion is sent using a PendingIntent. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_LOCATIONS` Key used for an extra holding a array of `https://developer.android.com/reference/android/location/Location`s when a location change is sent using a PendingIntent. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_LOCATION_CHANGED` Key used for an extra holding a `https://developer.android.com/reference/android/location/Location` value when a location change is sent using a PendingIntent. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_PROVIDER_ENABLED` Key used for an extra holding a boolean enabled/disabled status value when a provider enabled/disabled event is broadcast using a PendingIntent. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_PROXIMITY_ENTERING` Key used for the Bundle extra holding a boolean indicating whether a proximity alert is entering (true) or exiting (false).. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#KEY_STATUS_CHANGED` *This constant was deprecated in API level 29. Status changes are deprecated and no longer broadcast from Android Q onwards.* |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION` Broadcast intent action when the device location enabled state changes. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#NETWORK_PROVIDER` Standard name of the network location provider. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#PASSIVE_PROVIDER` A special location provider for receiving locations without actively initiating a location fix. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION` Broadcast intent action when the set of enabled location providers changes. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#addGpsStatusListener(android.location.GpsStatus.Listener)(https://developer.android.com/reference/android/location/GpsStatus.Listener listener) ` *This method was deprecated in API level 24. Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener,%20android.os.Handler)(https://developer.android.com/reference/android/location/OnNmeaMessageListener listener, https://developer.android.com/reference/android/os/Handler handler) ` Adds an NMEA listener. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener)(https://developer.android.com/reference/android/location/OnNmeaMessageListener listener) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.GpsStatus.NmeaListener)(https://developer.android.com/reference/android/location/GpsStatus.NmeaListener listener) ` *This method was deprecated in API level 24. Use `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/OnNmeaMessageListener listener) ` Adds an NMEA listener. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#addProximityAlert(double,%20double,%20float,%20long,%20android.app.PendingIntent)(double latitude, double longitude, float radius, long expiration, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` Sets a proximity alert for the location given by the position (latitude, longitude) and the given radius. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#addTestProvider(java.lang.String,%20android.location.provider.ProviderProperties)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/provider/ProviderProperties properties) ` Creates a test location provider and adds it to the set of active providers. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#addTestProvider(java.lang.String,%20android.location.provider.ProviderProperties,%20java.util.Set<java.lang.String>)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/provider/ProviderProperties properties, https://developer.android.com/reference/java/util/Set<https://developer.android.com/reference/java/lang/String> extraAttributionTags) ` Creates a test location provider and adds it to the set of active providers. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#addTestProvider(java.lang.String,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20boolean,%20int,%20int)(https://developer.android.com/reference/java/lang/String provider, boolean requiresNetwork, boolean requiresSatellite, boolean requiresCell, boolean hasMonetaryCost, boolean supportsAltitude, boolean supportsSpeed, boolean supportsBearing, int powerUsage, int accuracy) ` Creates a test location provider and adds it to the set of active providers. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#clearTestProviderEnabled(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` *This method was deprecated in API level 29. Use `https://developer.android.com/reference/android/location/LocationManager#setTestProviderEnabled(java.lang.String,%20boolean)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#clearTestProviderLocation(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` *This method was deprecated in API level 29. This method has always been a no-op, and may be removed in the future.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#clearTestProviderStatus(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` *This method was deprecated in API level 29. This method has no effect.* |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/location/LocationManager#getAllProviders()() ` Returns a list of the names of all available location providers. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/location/LocationManager#getBestProvider(android.location.Criteria,%20boolean)(https://developer.android.com/reference/android/location/Criteria criteria, boolean enabledOnly) ` *This method was deprecated in API level 34. Criteria based APIs are deprecated, prefer to select a provider explicitly.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.location.LocationRequest,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/LocationRequest locationRequest, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/android/location/Location> consumer) ` Asynchronously returns a single current location fix from the given provider based on the given `https://developer.android.com/reference/android/location/LocationRequest`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/os/CancellationSignal cancellationSignal, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/java/util/function/Consumer<https://developer.android.com/reference/android/location/Location> consumer) ` Asynchronously returns a single current location fix from the given provider. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/location/GnssAntennaInfo>` | ` https://developer.android.com/reference/android/location/LocationManager#getGnssAntennaInfos()() ` Returns the current list of GNSS antenna infos, or null if unknown or unsupported. |
| ` https://developer.android.com/reference/android/location/GnssCapabilities` | ` https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()() ` Returns the supported capabilities of the GNSS chipset. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/location/LocationManager#getGnssHardwareModelName()() ` Returns the model name (including vendor and hardware/software version) of the GNSS hardware driver, or null if this information is not available. |
| ` int` | ` https://developer.android.com/reference/android/location/LocationManager#getGnssYearOfHardware()() ` Returns the model year of the GNSS hardware and software build, or 0 if the model year is before 2016. |
| ` https://developer.android.com/reference/android/location/GpsStatus` | ` https://developer.android.com/reference/android/location/LocationManager#getGpsStatus(android.location.GpsStatus)(https://developer.android.com/reference/android/location/GpsStatus status) ` *This method was deprecated in API level 24. GpsStatus APIs are deprecated, use `https://developer.android.com/reference/android/location/GnssStatus` APIs instead. No longer supported in apps targeting S and above.* |
| ` https://developer.android.com/reference/android/location/Location` | ` https://developer.android.com/reference/android/location/LocationManager#getLastKnownLocation(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Gets the last known location from the given provider, or null if there is no last known location. |
| ` https://developer.android.com/reference/android/location/LocationProvider` | ` https://developer.android.com/reference/android/location/LocationManager#getProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` *This method was deprecated in API level 31. This method has no way to indicate that a provider's properties are unknown, and so may return incorrect results on rare occasions. Use `https://developer.android.com/reference/android/location/LocationManager#getProviderProperties(java.lang.String)` instead.* |
| ` https://developer.android.com/reference/android/location/provider/ProviderProperties` | ` https://developer.android.com/reference/android/location/LocationManager#getProviderProperties(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Returns the properties of the given provider, or null if the properties are currently unknown. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/location/LocationManager#getProviders(boolean)(boolean enabledOnly) ` Returns a list of the names of available location providers. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | ` https://developer.android.com/reference/android/location/LocationManager#getProviders(android.location.Criteria,%20boolean)(https://developer.android.com/reference/android/location/Criteria criteria, boolean enabledOnly) ` *This method was deprecated in API level 34. Criteria based APIs are deprecated, prefer to select a provider explicitly.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#hasProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Returns true if the given location provider exists on this device, irrespective of whether it is currently enabled or not. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#isLocationEnabled()() ` Returns the current enabled/disabled state of location. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#isProviderEnabled(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Returns the current enabled/disabled status of the given provider. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerAntennaInfoListener(java.util.concurrent.Executor,%20android.location.GnssAntennaInfo.Listener)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/GnssAntennaInfo.Listener listener) ` Registers a GNSS antenna info listener that will receive all changes to antenna info. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback callback) ` Registers a GNSS measurements callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback)(https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback callback) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(android.location.GnssMeasurementRequest,%20java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)(https://developer.android.com/reference/android/location/GnssMeasurementRequest request, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback callback) ` Registers a GNSS measurement callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback,%20android.os.Handler)(https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback callback, https://developer.android.com/reference/android/os/Handler handler) ` Registers a GNSS measurements callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback,%20android.os.Handler)(https://developer.android.com/reference/android/location/GnssNavigationMessage.Callback callback, https://developer.android.com/reference/android/os/Handler handler) ` Registers a GNSS navigation message callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(java.util.concurrent.Executor,%20android.location.GnssNavigationMessage.Callback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/GnssNavigationMessage.Callback callback) ` Registers a GNSS navigation message callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback)(https://developer.android.com/reference/android/location/GnssNavigationMessage.Callback callback) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(java.util.concurrent.Executor,%20android.location.GnssNavigationMessage.Callback)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback)(https://developer.android.com/reference/android/location/GnssStatus.Callback callback) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` instead.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback,%20android.os.Handler)(https://developer.android.com/reference/android/location/GnssStatus.Callback callback, https://developer.android.com/reference/android/os/Handler handler) ` Registers a GNSS status callback. |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)(https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/GnssStatus.Callback callback) ` Registers a GNSS status callback. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeGpsStatusListener(android.location.GpsStatus.Listener)(https://developer.android.com/reference/android/location/GpsStatus.Listener listener) ` *This method was deprecated in API level 24. use `https://developer.android.com/reference/android/location/LocationManager#unregisterGnssStatusCallback(android.location.GnssStatus.Callback)` instead. No longer supported in apps targeting S and above.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeNmeaListener(android.location.OnNmeaMessageListener)(https://developer.android.com/reference/android/location/OnNmeaMessageListener listener) ` Removes an NMEA listener. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeNmeaListener(android.location.GpsStatus.NmeaListener)(https://developer.android.com/reference/android/location/GpsStatus.NmeaListener listener) ` *This method was deprecated in API level 24. Use `https://developer.android.com/reference/android/location/LocationManager#removeNmeaListener(android.location.OnNmeaMessageListener)` instead.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeProximityAlert(android.app.PendingIntent)(https://developer.android.com/reference/android/app/PendingIntent intent) ` Removes the proximity alert with the given PendingIntent. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeTestProvider(java.lang.String)(https://developer.android.com/reference/java/lang/String provider) ` Removes the test location provider with the given name or does nothing if no such test location provider exists. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.location.LocationListener)(https://developer.android.com/reference/android/location/LocationListener listener) ` Removes all location updates for the specified `https://developer.android.com/reference/android/location/LocationListener`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.app.PendingIntent)(https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` Removes location updates for the specified `https://developer.android.com/reference/android/app/PendingIntent`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestFlush(java.lang.String,%20android.location.LocationListener,%20int)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/LocationListener listener, int requestCode) ` Requests that the given provider flush any batched locations to listeners. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestFlush(java.lang.String,%20android.app.PendingIntent,%20int)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/app/PendingIntent pendingIntent, int requestCode) ` Requests that the given provider flush any batched locations to listeners. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener)(https://developer.android.com/reference/java/lang/String provider, long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/location/LocationListener listener) ` Register for location updates from the given provider with the given arguments, and a callback on the `https://developer.android.com/reference/android/os/Looper` of the calling thread. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.location.LocationListener,%20android.os.Looper)(long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/location/Criteria criteria, https://developer.android.com/reference/android/location/LocationListener listener, https://developer.android.com/reference/android/os/Looper looper) ` *This method was deprecated in API level 31. Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener,%20android.os.Looper)` instead to explicitly select a provider.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener,%20android.os.Looper)(https://developer.android.com/reference/java/lang/String provider, long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/location/LocationListener listener, https://developer.android.com/reference/android/os/Looper looper) ` Register for location updates from the given provider with the given arguments, and a callback on the specified `https://developer.android.com/reference/android/os/Looper`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20java.util.concurrent.Executor,%20android.location.LocationListener)(https://developer.android.com/reference/java/lang/String provider, long minTimeMs, float minDistanceM, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/LocationListener listener) ` Register for location updates using the named provider, and a callback on the specified `https://developer.android.com/reference/java/util/concurrent/Executor`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20android.app.PendingIntent)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/LocationRequest locationRequest, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` Register for location updates from the specified provider, using a `https://developer.android.com/reference/android/location/LocationRequest`, and callbacks delivered via the provided `https://developer.android.com/reference/android/app/PendingIntent`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/LocationRequest locationRequest, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/LocationListener listener) ` Register for location updates from the specified provider, using a `https://developer.android.com/reference/android/location/LocationRequest`, and a callback on the specified `https://developer.android.com/reference/java/util/concurrent/Executor`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent)(long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/location/Criteria criteria, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` *This method was deprecated in API level 31. Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.app.PendingIntent)` instead to explicitly select a provider.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20java.util.concurrent.Executor,%20android.location.LocationListener)(long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/location/Criteria criteria, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/location/LocationListener listener) ` *This method was deprecated in API level 31. Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20java.util.concurrent.Executor,%20android.location.LocationListener)` instead to explicitly select a provider.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.app.PendingIntent)(https://developer.android.com/reference/java/lang/String provider, long minTimeMs, float minDistanceM, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` Register for location updates using the named provider, and callbacks delivered via the provided `https://developer.android.com/reference/android/app/PendingIntent`. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestSingleUpdate(java.lang.String,%20android.app.PendingIntent)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestSingleUpdate(android.location.Criteria,%20android.app.PendingIntent)(https://developer.android.com/reference/android/location/Criteria criteria, https://developer.android.com/reference/android/app/PendingIntent pendingIntent) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestSingleUpdate(java.lang.String,%20android.location.LocationListener,%20android.os.Looper)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/LocationListener listener, https://developer.android.com/reference/android/os/Looper looper) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#requestSingleUpdate(android.location.Criteria,%20android.location.LocationListener,%20android.os.Looper)(https://developer.android.com/reference/android/location/Criteria criteria, https://developer.android.com/reference/android/location/LocationListener listener, https://developer.android.com/reference/android/os/Looper looper) ` *This method was deprecated in API level 30. Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.* |
| ` boolean` | ` https://developer.android.com/reference/android/location/LocationManager#sendExtraCommand(java.lang.String,%20java.lang.String,%20android.os.Bundle)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/java/lang/String command, https://developer.android.com/reference/android/os/Bundle extras) ` Sends additional commands to a location provider. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#setTestProviderEnabled(java.lang.String,%20boolean)(https://developer.android.com/reference/java/lang/String provider, boolean enabled) ` Sets the given test provider to be enabled or disabled. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#setTestProviderLocation(java.lang.String,%20android.location.Location)(https://developer.android.com/reference/java/lang/String provider, https://developer.android.com/reference/android/location/Location location) ` Sets a new location for the given test provider. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#setTestProviderStatus(java.lang.String,%20int,%20android.os.Bundle,%20long)(https://developer.android.com/reference/java/lang/String provider, int status, https://developer.android.com/reference/android/os/Bundle extras, long updateTime) ` *This method was deprecated in API level 29. This method has no effect.* |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#unregisterAntennaInfoListener(android.location.GnssAntennaInfo.Listener)(https://developer.android.com/reference/android/location/GnssAntennaInfo.Listener listener) ` Unregisters a GNSS antenna info listener. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback)(https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback callback) ` Unregisters a GPS Measurement callback. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#unregisterGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback)(https://developer.android.com/reference/android/location/GnssNavigationMessage.Callback callback) ` Unregisters a GNSS Navigation Message callback. |
| ` void` | ` https://developer.android.com/reference/android/location/LocationManager#unregisterGnssStatusCallback(android.location.GnssStatus.Callback)(https://developer.android.com/reference/android/location/GnssStatus.Callback callback) ` Removes a GNSS status callback. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### ACTION_GNSS_CAPABILITIES_CHANGED

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String ACTION_GNSS_CAPABILITIES_CHANGED
```

Broadcast intent action when GNSS capabilities change. This is most common at boot time as GNSS capabilities are queried from the chipset. Includes an intent extra, `https://developer.android.com/reference/android/location/LocationManager#EXTRA_GNSS_CAPABILITIES`, with the new `https://developer.android.com/reference/android/location/GnssCapabilities`.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_GNSS_CAPABILITIES`
- `https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()`

Constant Value: "android.location.action.GNSS_CAPABILITIES_CHANGED"

### EXTRA_GNSS_CAPABILITIES

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_GNSS_CAPABILITIES
```

Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#ACTION_GNSS_CAPABILITIES_CHANGED` broadcasts, containing the new `https://developer.android.com/reference/android/location/GnssCapabilities`.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#ACTION_GNSS_CAPABILITIES_CHANGED`

Constant Value: "android.location.extra.GNSS_CAPABILITIES"

### EXTRA_LOCATION_ENABLED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_LOCATION_ENABLED
```

Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION` broadcasts, containing the boolean enabled state of location.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION`

Constant Value: "android.location.extra.LOCATION_ENABLED"

### EXTRA_PROVIDER_ENABLED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_PROVIDER_ENABLED
```

Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION` broadcasts, containing the boolean enabled state of the location provider that has changed.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION`
- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_NAME`

Constant Value: "android.location.extra.PROVIDER_ENABLED"

### EXTRA_PROVIDER_NAME

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String EXTRA_PROVIDER_NAME
```

Intent extra included with `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION` broadcasts, containing the name of the location provider that has changed.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION`
- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_ENABLED`

Constant Value: "android.location.extra.PROVIDER_NAME"

### FUSED_PROVIDER

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String FUSED_PROVIDER
```

Standard name of the fused location provider.

If present, this provider may combine inputs from several other location providers to provide the best possible location fix. It is implicitly used for all requestLocationUpdates APIs that involve a `https://developer.android.com/reference/android/location/Criteria`.

<br />

Constant Value: "fused"

### GPS_PROVIDER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String GPS_PROVIDER
```

Standard name of the GNSS location provider.

If present, this provider determines location using GNSS satellites. The responsiveness and accuracy of location fixes may depend on GNSS signal conditions.

Locations returned from this provider are with respect to the primary GNSS antenna position within the device. `https://developer.android.com/reference/android/location/LocationManager#getGnssAntennaInfos()` may be used to determine the GNSS antenna position with respect to the Android Coordinate System, and convert between them if necessary. This is generally only necessary for high accuracy applications.

The extras Bundle for locations derived by this location provider may contain the following key/value pairs:

- satellites - the number of satellites used to derive the fix

<br />

<br />

Constant Value: "gps"

### KEY_FLUSH_COMPLETE

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_FLUSH_COMPLETE
```

Key used for an extra holding an integer request code when location flush completion is sent using a PendingIntent.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#requestFlush(java.lang.String,%20android.app.PendingIntent,%20int)`

Constant Value: "flushComplete"

### KEY_LOCATIONS

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_LOCATIONS
```

Key used for an extra holding a array of `https://developer.android.com/reference/android/location/Location`s when a location change is sent using a PendingIntent. This key will only be present if the location change includes multiple (ie, batched) locations, otherwise only `https://developer.android.com/reference/android/location/LocationManager#KEY_LOCATION_CHANGED` will be present. Use `https://developer.android.com/reference/android/content/Intent#getParcelableArrayExtra(java.lang.String)` to retrieve the locations.

The array of locations will never be empty, and will ordered from earliest location to latest location, the same as with `https://developer.android.com/reference/android/location/LocationListener#onLocationChanged(java.util.List<android.location.Location>)`.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20android.app.PendingIntent)`

Constant Value: "locations"

### KEY_LOCATION_CHANGED

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_LOCATION_CHANGED
```

Key used for an extra holding a `https://developer.android.com/reference/android/location/Location` value when a location change is sent using a PendingIntent. If the location change includes a list of batched locations via `https://developer.android.com/reference/android/location/LocationManager#KEY_LOCATIONS` then this key will still be present, and will hold the last location in the batch. Use `https://developer.android.com/reference/android/content/Intent#getParcelableExtra(java.lang.String)` to retrieve the location.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20android.app.PendingIntent)`

Constant Value: "location"

### KEY_PROVIDER_ENABLED

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_PROVIDER_ENABLED
```

Key used for an extra holding a boolean enabled/disabled status value when a provider enabled/disabled event is broadcast using a PendingIntent.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20android.app.PendingIntent)`

Constant Value: "providerEnabled"

### KEY_PROXIMITY_ENTERING

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_PROXIMITY_ENTERING
```

Key used for the Bundle extra holding a boolean indicating whether a proximity alert is entering (true) or exiting (false)..

<br />

Constant Value: "entering"

### KEY_STATUS_CHANGED

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String KEY_STATUS_CHANGED
```

<br />

**This constant was deprecated in API level 29.**   

Status changes are deprecated and no longer broadcast from Android Q onwards.

This key is no longer in use.

Key used for a Bundle extra holding an Integer status value when a status change is broadcast using a PendingIntent.

<br />

Constant Value: "status"

### MODE_CHANGED_ACTION

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String MODE_CHANGED_ACTION
```

Broadcast intent action when the device location enabled state changes. From Android R and above, will include a boolean intent extra, `https://developer.android.com/reference/android/location/LocationManager#EXTRA_LOCATION_ENABLED`, with the enabled state of location.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_LOCATION_ENABLED`
- `https://developer.android.com/reference/android/location/LocationManager#isLocationEnabled()`

Constant Value: "android.location.MODE_CHANGED"

### NETWORK_PROVIDER

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String NETWORK_PROVIDER
```

Standard name of the network location provider.

If present, this provider determines location based on nearby of cell tower and WiFi access points. Operation of this provider may require a data connection.

<br />

Constant Value: "network"

### PASSIVE_PROVIDER

Added in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PASSIVE_PROVIDER
```

A special location provider for receiving locations without actively initiating a location fix. This location provider is always present.

This provider can be used to passively receive location updates when other applications or services request them without actually requesting the locations yourself. This provider will only return locations generated by other providers.

<br />

Constant Value: "passive"

### PROVIDERS_CHANGED_ACTION

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final String PROVIDERS_CHANGED_ACTION
```

Broadcast intent action when the set of enabled location providers changes. To check the status of a provider, use `https://developer.android.com/reference/android/location/LocationManager#isProviderEnabled(java.lang.String)`. From Android Q and above, will include a string intent extra, `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_NAME`, with the name of the provider whose state has changed. From Android R and above, will include a boolean intent extra, `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_ENABLED`, with the enabled state of the provider.

<br />

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_NAME`
- `https://developer.android.com/reference/android/location/LocationManager#EXTRA_PROVIDER_ENABLED`
- `https://developer.android.com/reference/android/location/LocationManager#isProviderEnabled(java.lang.String)`

Constant Value: "android.location.PROVIDERS_CHANGED"

## Public methods

### addGpsStatusListener

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addGpsStatusListener (GpsStatus.Listener listener)
```

<br />

**This method was deprecated in API level 24.**   

Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` instead.

Adds a GPS status listener.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `listener` | `GpsStatus.Listener`: GPS status listener object to register <br /> |

| Returns ||
|---|---|
| `boolean` | true if the listener was successfully added <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### addNmeaListener

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addNmeaListener (OnNmeaMessageListener listener, 
                Handler handler)
```

Adds an NMEA listener.

See `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `listener` | `OnNmeaMessageListener`: the listener to register. This value cannot be `null`. <br /> |
| `handler` | `Handler`: the handler that the listener runs on. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### addNmeaListener

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addNmeaListener (OnNmeaMessageListener listener)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` instead.

Adds an NMEA listener.

See `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `listener` | `OnNmeaMessageListener`: the listener to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### addNmeaListener

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addNmeaListener (GpsStatus.NmeaListener listener)
```

<br />

**This method was deprecated in API level 24.**   

Use `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(android.location.OnNmeaMessageListener,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#addNmeaListener(java.util.concurrent.Executor,%20android.location.OnNmeaMessageListener)` instead.

No-op method to keep backward-compatibility.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `listener` | `GpsStatus.NmeaListener`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | <br /> |

### addNmeaListener

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addNmeaListener (Executor executor, 
                OnNmeaMessageListener listener)
```

Adds an NMEA listener. GNSS NMEA information will only be received while the `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` is enabled, and while the client app is in the foreground.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor that the listener runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `OnNmeaMessageListener`: the listener to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### addProximityAlert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addProximityAlert (double latitude, 
                double longitude, 
                float radius, 
                long expiration, 
                PendingIntent pendingIntent)
```

Sets a proximity alert for the location given by the position (latitude, longitude) and the given radius.

When the device detects that it has entered or exited the area surrounding the location, the given PendingIntent will be fired.

The fired intent will have a boolean extra added with key `https://developer.android.com/reference/android/location/LocationManager#KEY_PROXIMITY_ENTERING`. If the value is true, the device is entering the proximity region; if false, it is exiting.

Due to the approximate nature of position estimation, if the device passes through the given area briefly, it is possible that no Intent will be fired. Similarly, an intent could be fired if the device passes very close to the given area but does not actually enter it.

Before API version 17, this method could be used with `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. From API version 17 and onwards, this method requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permission.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `latitude` | `double`: the latitude of the central point of the alert region <br /> |
| `longitude` | `double`: the longitude of the central point of the alert region <br /> |
| `radius` | `float`: the radius of the central point of the alert region in meters <br /> |
| `expiration` | `long`: expiration realtime for this proximity alert in milliseconds, or -1 to indicate no expiration <br /> |
| `pendingIntent` | `PendingIntent`: a `https://developer.android.com/reference/android/app/PendingIntent` that will sent when entry to or exit from the alert region is detected. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permission is not present |

### addTestProvider

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addTestProvider (String provider, 
                ProviderProperties properties)
```

Creates a test location provider and adds it to the set of active providers. This provider will replace any provider with the same name that exists prior to this call.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |
| `properties` | `ProviderProperties`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if properties is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### addTestProvider

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addTestProvider (String provider, 
                ProviderProperties properties, 
                Set<String> extraAttributionTags)
```

Creates a test location provider and adds it to the set of active providers. This provider will replace any provider with the same name that exists prior to this call.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |
| `properties` | `ProviderProperties`: the provider properties. This value cannot be `null`. <br /> |
| `extraAttributionTags` | `Set`: additional attribution tags associated with this provider. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if properties is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### addTestProvider

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addTestProvider (String provider, 
                boolean requiresNetwork, 
                boolean requiresSatellite, 
                boolean requiresCell, 
                boolean hasMonetaryCost, 
                boolean supportsAltitude, 
                boolean supportsSpeed, 
                boolean supportsBearing, 
                int powerUsage, 
                int accuracy)
```

Creates a test location provider and adds it to the set of active providers. This provider will replace any provider with the same name that exists prior to this call.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |
| `requiresNetwork` | `boolean` <br /> |
| `requiresSatellite` | `boolean` <br /> |
| `requiresCell` | `boolean` <br /> |
| `hasMonetaryCost` | `boolean` <br /> |
| `supportsAltitude` | `boolean` <br /> |
| `supportsSpeed` | `boolean` <br /> |
| `supportsBearing` | `boolean` <br /> |
| `powerUsage` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/location/provider/ProviderProperties#POWER_USAGE_LOW` - `https://developer.android.com/reference/android/location/provider/ProviderProperties#POWER_USAGE_MEDIUM` - `https://developer.android.com/reference/android/location/provider/ProviderProperties#POWER_USAGE_HIGH` |
| `accuracy` | `int`: Value is one of the following: - `https://developer.android.com/reference/android/location/provider/ProviderProperties#ACCURACY_FINE` - `https://developer.android.com/reference/android/location/provider/ProviderProperties#ACCURACY_COARSE` |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### clearTestProviderEnabled

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearTestProviderEnabled (String provider)
```

<br />

**This method was deprecated in API level 29.**   

Use `https://developer.android.com/reference/android/location/LocationManager#setTestProviderEnabled(java.lang.String,%20boolean)` instead.

Equivalent to calling `https://developer.android.com/reference/android/location/LocationManager#setTestProviderEnabled(java.lang.String,%20boolean)` to disable a test provider.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: This value cannot be `null`. <br /> |

### clearTestProviderLocation

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearTestProviderLocation (String provider)
```

<br />

**This method was deprecated in API level 29.**   

This method has always been a no-op, and may be removed in the future.

Does nothing.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: This value cannot be `null`. <br /> |

### clearTestProviderStatus

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clearTestProviderStatus (String provider)
```

<br />

**This method was deprecated in API level 29.**   

This method has no effect.

This method has no effect as provider status has been deprecated and is no longer supported.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: This value cannot be `null`. <br /> |

### getAllProviders

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getAllProviders ()
```

Returns a list of the names of all available location providers. All providers are returned, including those that are currently disabled.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | list of provider names. This value cannot be `null`. <br /> |

### getBestProvider

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getBestProvider (Criteria criteria, 
                boolean enabledOnly)
```

<br />

**This method was deprecated in API level 34.**   

Criteria based APIs are deprecated, prefer to select a provider explicitly.

Returns the name of the provider that best meets the given criteria. Only providers that are permitted to be accessed by the caller will be returned. If several providers meet the criteria, the one with the best accuracy is returned. If no provider meets the criteria, the criteria are loosened in the following order:

- power requirement
- accuracy
- bearing
- speed
- altitude

Note that the requirement on monetary cost is not removed in this process.

<br />

| Parameters ||
|---|---|
| `criteria` | `Criteria`: the criteria that need to be matched. This value cannot be `null`. <br /> |
| `enabledOnly` | `boolean`: if true then only enabled providers are included <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | name of the provider that best matches the criteria, or null if none match <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if criteria is null |

### getCurrentLocation

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getCurrentLocation (String provider, 
                LocationRequest locationRequest, 
                CancellationSignal cancellationSignal, 
                Executor executor, 
                Consumer<Location> consumer)
```

Asynchronously returns a single current location fix from the given provider based on the given `https://developer.android.com/reference/android/location/LocationRequest`. This may activate sensors in order to compute a new location, unlike `https://developer.android.com/reference/android/location/LocationManager#getLastKnownLocation(java.lang.String)`, which will only return a cached fix if available. The given callback will be invoked once and only once, either with a valid location or with a null location if the provider was unable to generate a valid location.

A client may supply an optional `https://developer.android.com/reference/android/os/CancellationSignal`. If this is used to cancel the operation, no callback should be expected after the cancellation.

This method may return locations from the very recent past (on the order of several seconds), but will never return older locations (for example, several minutes old or older). Clients may rely upon the guarantee that if this method returns a location, it will represent the best estimation of the location of the device in the present moment.

Clients calling this method from the background may notice that the method fails to determine a valid location fix more often than while in the foreground. Background applications may be throttled in their location accesses to some degree. The given location request may be used to provide hints on how a fresh location is computed if necessary. In particular `https://developer.android.com/reference/android/location/LocationRequest#getDurationMillis()` can be used to provide maximum duration allowed before failing. The system will always cap the maximum amount of time a request for current location may run to some reasonable value (less than a minute for example) before the request is failed.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `locationRequest` | `LocationRequest`: the location request containing location parameters. This value cannot be `null`. <br /> |
| `cancellationSignal` | `CancellationSignal`: an optional signal that allows for cancelling this call. This value may be `null`. <br /> |
| `executor` | `Executor`: the callback will take place on this `https://developer.android.com/reference/java/util/concurrent/Executor` This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `consumer` | `Consumer`: the callback invoked with either a `https://developer.android.com/reference/android/location/Location` or null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if consumer is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### getCurrentLocation

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void getCurrentLocation (String provider, 
                CancellationSignal cancellationSignal, 
                Executor executor, 
                Consumer<Location> consumer)
```

Asynchronously returns a single current location fix from the given provider.

See `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.location.LocationRequest,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` for more information.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `cancellationSignal` | `CancellationSignal`: an optional signal that allows for cancelling this call. This value may be `null`. <br /> |
| `executor` | `Executor`: the callback will take place on this `https://developer.android.com/reference/java/util/concurrent/Executor` This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `consumer` | `Consumer`: the callback invoked with either a `https://developer.android.com/reference/android/location/Location` or null <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if consumer is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### getGnssAntennaInfos

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<GnssAntennaInfo> getGnssAntennaInfos ()
```

Returns the current list of GNSS antenna infos, or null if unknown or unsupported.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/location/GnssAntennaInfo>` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()`

### getGnssCapabilities

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GnssCapabilities getGnssCapabilities ()
```

Returns the supported capabilities of the GNSS chipset.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/location/GnssCapabilities` | This value cannot be `null`. <br /> |

### getGnssHardwareModelName

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String getGnssHardwareModelName ()
```

Returns the model name (including vendor and hardware/software version) of the GNSS hardware driver, or null if this information is not available.

No device-specific serial number or ID is returned from this API.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | <br /> |

### getGnssYearOfHardware

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getGnssYearOfHardware ()
```

Returns the model year of the GNSS hardware and software build, or 0 if the model year is before 2016.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getGpsStatus

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public GpsStatus getGpsStatus (GpsStatus status)
```

<br />

**This method was deprecated in API level 24.**   

GpsStatus APIs are deprecated, use `https://developer.android.com/reference/android/location/GnssStatus` APIs instead. No longer supported in apps targeting S and above.

Retrieves information about the current status of the GPS engine. This should only be called from within the `https://developer.android.com/reference/android/location/GpsStatus.Listener#onGpsStatusChanged(int)` callback to ensure that the data is copied atomically. The caller may either pass in an existing `https://developer.android.com/reference/android/location/GpsStatus` object to be overwritten, or pass null to create a new `https://developer.android.com/reference/android/location/GpsStatus` object.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `status` | `GpsStatus`: object containing GPS status details, or null. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/location/GpsStatus` | status object containing updated GPS status. <br /> |

### getLastKnownLocation

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Location getLastKnownLocation (String provider)
```

Gets the last known location from the given provider, or null if there is no last known location. The returned location may be quite old in some circumstances, so the age of the location should always be checked.

This will never activate sensors to compute a new location, and will only ever return a cached location.

See also `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` which will always attempt to return a current location, but will potentially use additional power in the course of the attempt as compared to this method.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/location/Location` | the last known location for the given provider, or null if not available <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### getProvider

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public LocationProvider getProvider (String provider)
```

<br />

**This method was deprecated in API level 31.**   

This method has no way to indicate that a provider's properties are unknown, and so may return incorrect results on rare occasions. Use `https://developer.android.com/reference/android/location/LocationManager#getProviderProperties(java.lang.String)` instead.

Returns the information about the location provider with the given name, or null if no provider exists by that name.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/location/LocationProvider` | location provider information, or null if provider does not exist <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |

### getProviderProperties

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ProviderProperties getProviderProperties (String provider)
```

Returns the properties of the given provider, or null if the properties are currently unknown. Provider properties may change over time, although this is discouraged, and should be rare. The most common transition is when provider properties go from being unknown to known, which is most common near boot time.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/location/provider/ProviderProperties` | location provider properties, or null if properties are currently unknown <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or does not exist |

### getProviders

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getProviders (boolean enabledOnly)
```

Returns a list of the names of available location providers. If `enabledOnly` is false, this is functionally the same as `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()`.

<br />

| Parameters ||
|---|---|
| `enabledOnly` | `boolean`: if true then only enabled providers are included <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | list of provider names. This value cannot be `null`. <br /> |

### getProviders

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<String> getProviders (Criteria criteria, 
                boolean enabledOnly)
```

<br />

**This method was deprecated in API level 34.**   

Criteria based APIs are deprecated, prefer to select a provider explicitly.

Returns a list of the names of available location providers that satisfy the given criteria.

<br />

| Parameters ||
|---|---|
| `criteria` | `Criteria`: the criteria that providers must match. This value cannot be `null`. <br /> |
| `enabledOnly` | `boolean`: if true then only enabled providers are included <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String>` | list of provider names. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if criteria is null |

### hasProvider

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean hasProvider (String provider)
```

Returns true if the given location provider exists on this device, irrespective of whether it is currently enabled or not.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a potential location provider. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the location provider exists, false otherwise <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |

### isLocationEnabled

Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isLocationEnabled ()
```

Returns the current enabled/disabled state of location. To listen for changes, see `https://developer.android.com/reference/android/location/LocationManager#MODE_CHANGED_ACTION`.

<br />

| Returns ||
|---|---|
| `boolean` | true if location is enabled and false if location is disabled. <br /> |

### isProviderEnabled

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isProviderEnabled (String provider)
```

Returns the current enabled/disabled status of the given provider. To listen for changes, see `https://developer.android.com/reference/android/location/LocationManager#PROVIDERS_CHANGED_ACTION`. Before API version `https://developer.android.com/reference/android/os/Build.VERSION_CODES#LOLLIPOP`, this method would throw `https://developer.android.com/reference/java/lang/SecurityException` if the location permissions were not sufficient to use the specified provider.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | true if the provider exists and is enabled <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |

### registerAntennaInfoListener

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerAntennaInfoListener (Executor executor, 
                GnssAntennaInfo.Listener listener)
```

Registers a GNSS antenna info listener that will receive all changes to antenna info. Use `https://developer.android.com/reference/android/location/LocationManager#getGnssAntennaInfos()` to get current antenna info.

Not all GNSS chipsets support antenna info updates, see `https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()`. If unsupported, the listener will never be invoked.

Prior to Android S, this requires the `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permission.

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor that the listener runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `GnssAntennaInfo.Listener`: the listener to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |

### registerGnssMeasurementsCallback

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssMeasurementsCallback (Executor executor, 
                GnssMeasurementsEvent.Callback callback)
```

Registers a GNSS measurements callback. GNSS measurements information will only be received while the `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` is enabled, and while the client app is in the foreground.

Not all GNSS chipsets support measurements updates, see `https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()`.

On Android R devices that have not yet upgraded to Android R QPR1, using this API will cause unavoidable crashes in the client application when GNSS measurements are received. If a client needs to receive GNSS measurements on Android R devices that have not been upgraded to QPR1, clients are instead encouraged to use [LocationManagerCompat.registerGnssMeasurementsCallback()](https://developer.android.com/reference/androidx/core/location/LocationManagerCompat#registerGnssMeasurementsCallback(android.location.LocationManager,java.util.concurrent.Executor,android.location.GnssMeasurementsEvent.Callback)) from the compat libraries instead to avoid this crash.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor that the callback runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `GnssMeasurementsEvent.Callback`: the callback to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssMeasurementsCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssMeasurementsCallback (GnssMeasurementsEvent.Callback callback)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)` instead.

Registers a GNSS measurements callback which will run on a binder thread.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `callback` | `GnssMeasurementsEvent.Callback`: a `https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback` object to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

### registerGnssMeasurementsCallback

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssMeasurementsCallback (GnssMeasurementRequest request, 
                Executor executor, 
                GnssMeasurementsEvent.Callback callback)
```

Registers a GNSS measurement callback.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `request` | `GnssMeasurementRequest`: extra parameters to pass to GNSS measurement provider. For example, if `https://developer.android.com/reference/android/location/GnssMeasurementRequest#isFullTracking()` is true, GNSS chipset switches off duty cycling. This value cannot be `null`. <br /> |
| `executor` | `Executor`: the executor that the callback runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `GnssMeasurementsEvent.Callback`: a `https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback` object to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always if the callback was added successfully, `false` otherwise. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if request is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssMeasurementsCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssMeasurementsCallback (GnssMeasurementsEvent.Callback callback, 
                Handler handler)
```

Registers a GNSS measurements callback.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssMeasurementsCallback(java.util.concurrent.Executor,%20android.location.GnssMeasurementsEvent.Callback)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `callback` | `GnssMeasurementsEvent.Callback`: a `https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback` object to register. This value cannot be `null`. <br /> |
| `handler` | `Handler`: the handler that the callback runs on. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssNavigationMessageCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssNavigationMessageCallback (GnssNavigationMessage.Callback callback, 
                Handler handler)
```

Registers a GNSS navigation message callback.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(java.util.concurrent.Executor,%20android.location.GnssNavigationMessage.Callback)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `callback` | `GnssNavigationMessage.Callback`: the callback to register. This value cannot be `null`. <br /> |
| `handler` | `Handler`: the handler that the callback runs on. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssNavigationMessageCallback

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssNavigationMessageCallback (Executor executor, 
                GnssNavigationMessage.Callback callback)
```

Registers a GNSS navigation message callback. GNSS navigation messages will only be received while the `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` is enabled, and while the client app is in the foreground.

Not all GNSS chipsets support navigation message updates, see `https://developer.android.com/reference/android/location/LocationManager#getGnssCapabilities()`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor that the callback runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `GnssNavigationMessage.Callback`: the callback to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssNavigationMessageCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssNavigationMessageCallback (GnssNavigationMessage.Callback callback)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(android.location.GnssNavigationMessage.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(java.util.concurrent.Executor,%20android.location.GnssNavigationMessage.Callback)` instead.

Registers a GNSS navigation message callback which will run on a binder thread.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssNavigationMessageCallback(java.util.concurrent.Executor,%20android.location.GnssNavigationMessage.Callback)` for more detail on how this method works.

<br />

| Parameters ||
|---|---|
| `callback` | `GnssNavigationMessage.Callback`: the callback to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

### registerGnssStatusCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssStatusCallback (GnssStatus.Callback callback)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(android.location.GnssStatus.Callback,%20android.os.Handler)` or `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` instead.

Registers a GNSS status callback. This method must be called from a `https://developer.android.com/reference/android/os/Looper` thread, and callbacks will occur on that looper.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `callback` | `GnssStatus.Callback`: the callback to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssStatusCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssStatusCallback (GnssStatus.Callback callback, 
                Handler handler)
```

Registers a GNSS status callback.

See `https://developer.android.com/reference/android/location/LocationManager#registerGnssStatusCallback(java.util.concurrent.Executor,%20android.location.GnssStatus.Callback)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `callback` | `GnssStatus.Callback`: the callback to register. This value cannot be `null`. <br /> |
| `handler` | `Handler`: the handler the callback runs on. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### registerGnssStatusCallback

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean registerGnssStatusCallback (Executor executor, 
                GnssStatus.Callback callback)
```

Registers a GNSS status callback. GNSS status information will only be received while the `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` is enabled, and while the client app is in the foreground.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `executor` | `Executor`: the executor that the callback runs on. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `callback` | `GnssStatus.Callback`: the callback to register. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` always <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if callback is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the ACCESS_FINE_LOCATION permission is not present |

### removeGpsStatusListener

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeGpsStatusListener (GpsStatus.Listener listener)
```

<br />

**This method was deprecated in API level 24.**   

use `https://developer.android.com/reference/android/location/LocationManager#unregisterGnssStatusCallback(android.location.GnssStatus.Callback)` instead. No longer supported in apps targeting S and above.

Removes a GPS status listener.

<br />

| Parameters ||
|---|---|
| `listener` | `GpsStatus.Listener`: GPS status listener object to remove <br /> |

### removeNmeaListener

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeNmeaListener (OnNmeaMessageListener listener)
```

Removes an NMEA listener.

<br />

| Parameters ||
|---|---|
| `listener` | `OnNmeaMessageListener`: a `https://developer.android.com/reference/android/location/OnNmeaMessageListener` object to remove. This value cannot be `null`. <br /> |

### removeNmeaListener

Added in [API level 5](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeNmeaListener (GpsStatus.NmeaListener listener)
```

<br />

**This method was deprecated in API level 24.**   

Use `https://developer.android.com/reference/android/location/LocationManager#removeNmeaListener(android.location.OnNmeaMessageListener)` instead.

No-op method to keep backward-compatibility.

<br />

| Parameters ||
|---|---|
| `listener` | `GpsStatus.NmeaListener`: This value cannot be `null`. <br /> |

### removeProximityAlert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeProximityAlert (PendingIntent intent)
```

Removes the proximity alert with the given PendingIntent.

Before API version 17, this method could be used with `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION`. From API version 17 and onwards, this method requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permission.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `intent` | `PendingIntent`: the PendingIntent that no longer needs to be notified of proximity alerts. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if intent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION` permission is not present |

### removeTestProvider

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeTestProvider (String provider)
```

Removes the test location provider with the given name or does nothing if no such test location provider exists.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### removeUpdates

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeUpdates (LocationListener listener)
```

Removes all location updates for the specified `https://developer.android.com/reference/android/location/LocationListener`. The given listener is guaranteed not to receive any invocations that **happens-after** this method is invoked.

If the given listener has any batched requests, this method will not flush any incomplete location batches before stopping location updates. If you wish to flush any pending locations before stopping, you must first call `https://developer.android.com/reference/android/location/LocationManager#requestFlush(java.lang.String,%20android.location.LocationListener,%20int)` and then call this method once the flush is complete. If this method is invoked before the flush is complete, you may not receive the flushed locations.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `listener` | `LocationListener`: listener that no longer needs location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |

### removeUpdates

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeUpdates (PendingIntent pendingIntent)
```

Removes location updates for the specified `https://developer.android.com/reference/android/app/PendingIntent`. Following this call, the PendingIntent will no longer receive location updates.

See `https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.location.LocationListener)` for more detail on how this method works.

<br />

| Parameters ||
|---|---|
| `pendingIntent` | `PendingIntent`: pending intent that no longer needs location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if pendingIntent is null |

### requestFlush

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestFlush (String provider, 
                LocationListener listener, 
                int requestCode)
```

Requests that the given provider flush any batched locations to listeners. The given listener (registered with the provider) will have `https://developer.android.com/reference/android/location/LocationListener#onFlushComplete(int)` invoked with the given result code after any locations that were flushed have been delivered. If `https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.location.LocationListener)` is invoked before the flush callback is executed, then the flush callback will never be executed.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `listener` | `LocationListener`: a listener registered under the provider. This value cannot be `null`. <br /> |
| `requestCode` | `int`: an arbitrary integer passed through to `https://developer.android.com/reference/android/location/LocationListener#onFlushComplete(int)` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null or is not registered under the provider |

### requestFlush

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestFlush (String provider, 
                PendingIntent pendingIntent, 
                int requestCode)
```

Requests that the given provider flush any batched locations to listeners. The given PendingIntent (registered with the provider) will be sent with `https://developer.android.com/reference/android/location/LocationManager#KEY_FLUSH_COMPLETE` present in the extra keys, and `requestCode` as the corresponding value.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `pendingIntent` | `PendingIntent`: a pendingIntent registered under the provider. This value cannot be `null`. <br /> |
| `requestCode` | `int`: an arbitrary integer that will be passed back as the extra value for `https://developer.android.com/reference/android/location/LocationManager#KEY_FLUSH_COMPLETE` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if pending intent is null or is not registered under the provider |

### requestLocationUpdates

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                long minTimeMs, 
                float minDistanceM, 
                LocationListener listener)
```

Register for location updates from the given provider with the given arguments, and a callback on the `https://developer.android.com/reference/android/os/Looper` of the calling thread.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)` for more detail on how this method works.

Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/RuntimeException` | if the calling thread has no Looper |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (long minTimeMs, 
                float minDistanceM, 
                Criteria criteria, 
                LocationListener listener, 
                Looper looper)
```

<br />

**This method was deprecated in API level 31.**   

Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener,%20android.os.Looper)` instead to explicitly select a provider.

Register for location updates using a provider selected through the given Criteria, and a callback on the specified `https://developer.android.com/reference/android/os/Looper`.

Note: Since Android KitKat, Criteria requests will always result in using the `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `criteria` | `Criteria`: contains parameters to choose the appropriate provider for location updates. This value cannot be `null`. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |
| `looper` | `Looper`: This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if criteria is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                long minTimeMs, 
                float minDistanceM, 
                LocationListener listener, 
                Looper looper)
```

Register for location updates from the given provider with the given arguments, and a callback on the specified `https://developer.android.com/reference/android/os/Looper`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)` for more detail on how this method works.

Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |
| `looper` | `Looper`: the looper handling listener callbacks, or null to use the looper of the calling thread <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                long minTimeMs, 
                float minDistanceM, 
                Executor executor, 
                LocationListener listener)
```

Register for location updates using the named provider, and a callback on the specified `https://developer.android.com/reference/java/util/concurrent/Executor`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)` for more detail on how this method works.

Prior to Jellybean, the minTime parameter was only a hint, and some location provider implementations ignored it. For Jellybean and onwards however, it is mandatory for Android compatible devices to observe both the minTime and minDistance parameters.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `executor` | `Executor`: the executor handling listener callbacks. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                LocationRequest locationRequest, 
                PendingIntent pendingIntent)
```

Register for location updates from the specified provider, using a `https://developer.android.com/reference/android/location/LocationRequest`, and callbacks delivered via the provided `https://developer.android.com/reference/android/app/PendingIntent`.

The delivered pending intents will contain extras with the callback information. The keys used for the extras are `https://developer.android.com/reference/android/location/LocationManager#KEY_LOCATION_CHANGED` and `https://developer.android.com/reference/android/location/LocationManager#KEY_PROVIDER_ENABLED`. See the documentation for each respective extra key for information on the values.

To unregister for location updates, use `https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.app.PendingIntent)`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `locationRequest` | `LocationRequest`: the location request containing location parameters. This value cannot be `null`. <br /> |
| `pendingIntent` | `PendingIntent`: the pending intent to send location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if locationRequest is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if pendingIntent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                LocationRequest locationRequest, 
                Executor executor, 
                LocationListener listener)
```

Register for location updates from the specified provider, using a `https://developer.android.com/reference/android/location/LocationRequest`, and a callback on the specified `https://developer.android.com/reference/java/util/concurrent/Executor`.

Only one request can be registered for each unique listener/provider pair, so any subsequent requests with the same provider and listener will overwrite all associated arguments. The same listener may be used across multiple providers with different requests for each provider.

It may take some time to receive the first location update depending on the conditions the device finds itself in. In order to take advantage of cached locations, application may consider using `https://developer.android.com/reference/android/location/LocationManager#getLastKnownLocation(java.lang.String)` or `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.location.LocationRequest,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead.

See `https://developer.android.com/reference/android/location/LocationRequest` documentation for an explanation of various request parameters and how they can affect the received locations.

If your application wants to passively observe location updates from all providers, then use the `https://developer.android.com/reference/android/location/LocationManager#PASSIVE_PROVIDER`. This provider does not turn on or modify active location providers, so you do not need to be as careful about minimum time and minimum distance parameters. However, if your application performs heavy work on a location update (such as network activity) then you should set an explicit fastest interval on your location request in case another application enables a location provider with extremely fast updates.

In case the provider you have selected is disabled, location updates will cease, and a provider availability update will be sent. As soon as the provider is enabled again, another provider availability update will be sent and location updates will resume.

Locations returned from `https://developer.android.com/reference/android/location/LocationManager#GPS_PROVIDER` are with respect to the primary GNSS antenna position within the device. `https://developer.android.com/reference/android/location/LocationManager#getGnssAntennaInfos()` may be used to determine the GNSS antenna position with respect to the Android Coordinate System, and convert between them if necessary. This is generally only necessary for high accuracy applications.

When location callbacks are invoked, the system will hold a wakelock on your application's behalf for some period of time, but not indefinitely. If your application requires a long running wakelock within the location callback, you should acquire it yourself.

Spamming location requests is a drain on system resources, and the system has preventative measures in place to ensure that this behavior will never result in more locations than could be achieved with a single location request with an equivalent interval that is left in place the whole time. As part of this amelioration, applications that target Android S and above may receive cached or historical locations through their listener. These locations will never be older than the interval of the location request.

To unregister for location updates, use `https://developer.android.com/reference/android/location/LocationManager#removeUpdates(android.location.LocationListener)`.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `locationRequest` | `LocationRequest`: the location request containing location parameters. This value cannot be `null`. <br /> |
| `executor` | `Executor`: the executor handling listener callbacks. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if locationRequest is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (long minTimeMs, 
                float minDistanceM, 
                Criteria criteria, 
                PendingIntent pendingIntent)
```

<br />

**This method was deprecated in API level 31.**   

Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.app.PendingIntent)` instead to explicitly select a provider.

Register for location updates using a provider selected through the given Criteria, and callbacks delivered via the provided `https://developer.android.com/reference/android/app/PendingIntent`.

Note: Since Android KitKat, Criteria requests will always result in using the `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.app.PendingIntent)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `criteria` | `Criteria`: contains parameters to choose the appropriate provider for location updates. This value cannot be `null`. <br /> |
| `pendingIntent` | `PendingIntent`: the pending intent to send location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if pendingIntent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (long minTimeMs, 
                float minDistanceM, 
                Criteria criteria, 
                Executor executor, 
                LocationListener listener)
```

<br />

**This method was deprecated in API level 31.**   

Use `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20java.util.concurrent.Executor,%20android.location.LocationListener)` instead to explicitly select a provider.

Register for location updates using a provider selected through the given Criteria, and a callback on the specified `https://developer.android.com/reference/java/util/concurrent/Executor`.

Note: Since Android KitKat, Criteria requests will always result in using the `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20java.util.concurrent.Executor,%20android.location.LocationListener)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `criteria` | `Criteria`: contains parameters to choose the appropriate provider for location updates. This value cannot be `null`. <br /> |
| `executor` | `Executor`: the executor handling listener callbacks. This value cannot be `null`. Callback and listener events are dispatched through this `https://developer.android.com/reference/java/util/concurrent/Executor`, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use `https://developer.android.com/reference/android/content/Context#getMainExecutor()`. Otherwise, provide an `https://developer.android.com/reference/java/util/concurrent/Executor` that dispatches to an appropriate thread. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if criteria is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if executor is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestLocationUpdates

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestLocationUpdates (String provider, 
                long minTimeMs, 
                float minDistanceM, 
                PendingIntent pendingIntent)
```

Register for location updates using the named provider, and callbacks delivered via the provided `https://developer.android.com/reference/android/app/PendingIntent`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20android.location.LocationRequest,%20android.app.PendingIntent)` for more detail on how this method works.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `minTimeMs` | `long`: minimum time interval between location updates in milliseconds <br /> |
| `minDistanceM` | `float`: minimum distance between location updates in meters <br /> |
| `pendingIntent` | `PendingIntent`: the pending intent to send location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if pendingIntent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestSingleUpdate

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestSingleUpdate (String provider, 
                PendingIntent pendingIntent)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.

Register for a single location update using a named provider and pending intent.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent)` for more detail on how to use this method.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `pendingIntent` | `PendingIntent`: the pending intent to send location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if intent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestSingleUpdate

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestSingleUpdate (Criteria criteria, 
                PendingIntent pendingIntent)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.

Register for a single location update using a Criteria and pending intent.

Note: Since Android KitKat, Criteria requests will always result in using the `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent)` for more detail on how to use this method.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `criteria` | `Criteria`: contains parameters to choose the appropriate provider for location updates. This value cannot be `null`. <br /> |
| `pendingIntent` | `PendingIntent`: the pending intent to send location updates. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if intent is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestSingleUpdate

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestSingleUpdate (String provider, 
                LocationListener listener, 
                Looper looper)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.

Register for a single location update using the named provider and a callback.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(java.lang.String,%20long,%20float,%20android.location.LocationListener,%20android.os.Looper)` for more detail on how to use this method.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |
| `looper` | `Looper`: the looper handling listener callbacks, or null to use the looper of the calling thread <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or doesn't exist |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### requestSingleUpdate

Added in [API level 9](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void requestSingleUpdate (Criteria criteria, 
                LocationListener listener, 
                Looper looper)
```

<br />

**This method was deprecated in API level 30.**   

Use `https://developer.android.com/reference/android/location/LocationManager#getCurrentLocation(java.lang.String,%20android.os.CancellationSignal,%20java.util.concurrent.Executor,%20java.util.function.Consumer<android.location.Location>)` instead as it does not carry a risk of extreme battery drain.

Register for a single location update using a Criteria and a callback.

Note: Since Android KitKat, Criteria requests will always result in using the `https://developer.android.com/reference/android/location/LocationManager#FUSED_PROVIDER`.

See `https://developer.android.com/reference/android/location/LocationManager#requestLocationUpdates(long,%20float,%20android.location.Criteria,%20android.app.PendingIntent)` for more detail on how to use this method.   

Requires `https://developer.android.com/reference/android/Manifest.permission#ACCESS_COARSE_LOCATION` or `https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION`

<br />

| Parameters ||
|---|---|
| `criteria` | `Criteria`: contains parameters to choose the appropriate provider for location updates. This value cannot be `null`. <br /> |
| `listener` | `LocationListener`: the listener to receive location updates. This value cannot be `null`. <br /> |
| `looper` | `Looper`: the looper handling listener callbacks, or null to use the looper of the calling thread <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if criteria is null |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if listener is null |
| `https://developer.android.com/reference/java/lang/SecurityException` | if no suitable permission is present |

### sendExtraCommand

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean sendExtraCommand (String provider, 
                String command, 
                Bundle extras)
```

Sends additional commands to a location provider. Can be used to support provider specific extensions to the Location Manager API.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: a provider listed by `https://developer.android.com/reference/android/location/LocationManager#getAllProviders()` This value cannot be `null`. <br /> |
| `command` | `String`: name of the command to send to the provider. This value cannot be `null`. <br /> |
| `extras` | `Bundle`: optional arguments for the command, or null <br /> |

| Returns ||
|---|---|
| `boolean` | true always, the return value may be ignored <br /> |

### setTestProviderEnabled

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTestProviderEnabled (String provider, 
                boolean enabled)
```

Sets the given test provider to be enabled or disabled.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |
| `enabled` | `boolean`: the mock enabled value <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if provider is null or not a test provider |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### setTestProviderLocation

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTestProviderLocation (String provider, 
                Location location)
```

Sets a new location for the given test provider. This location will be identiable as a mock location to all clients via `https://developer.android.com/reference/android/location/Location#isMock()`.

The location object must have a minimum number of fields set to be considered valid, as per documentation on `https://developer.android.com/reference/android/location/Location` class.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: the provider name. This value cannot be `null`. <br /> |
| `location` | `Location`: the mock location. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the provider is null or not a test provider |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the location is null or incomplete |
| `https://developer.android.com/reference/java/lang/SecurityException` | if `https://developer.android.com/reference/android/app/AppOpsManager#OPSTR_MOCK_LOCATION` is not set to `https://developer.android.com/reference/android/app/AppOpsManager#MODE_ALLOWED` for your app. |

### setTestProviderStatus

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTestProviderStatus (String provider, 
                int status, 
                Bundle extras, 
                long updateTime)
```

<br />

**This method was deprecated in API level 29.**   

This method has no effect.

This method has no effect as provider status has been deprecated and is no longer supported.

<br />

| Parameters ||
|---|---|
| `provider` | `String`: This value cannot be `null`. <br /> |
| `status` | `int` <br /> |
| `extras` | `Bundle`: This value may be `null`. <br /> |
| `updateTime` | `long` <br /> |

### unregisterAntennaInfoListener

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterAntennaInfoListener (GnssAntennaInfo.Listener listener)
```

Unregisters a GNSS antenna info listener.

<br />

| Parameters ||
|---|---|
| `listener` | `GnssAntennaInfo.Listener`: a `https://developer.android.com/reference/android/location/GnssAntennaInfo.Listener` object to remove. This value cannot be `null`. <br /> |

### unregisterGnssMeasurementsCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterGnssMeasurementsCallback (GnssMeasurementsEvent.Callback callback)
```

Unregisters a GPS Measurement callback.

<br />

| Parameters ||
|---|---|
| `callback` | `GnssMeasurementsEvent.Callback`: a `https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback` object to remove. This value cannot be `null`. <br /> |

### unregisterGnssNavigationMessageCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterGnssNavigationMessageCallback (GnssNavigationMessage.Callback callback)
```

Unregisters a GNSS Navigation Message callback.

<br />

| Parameters ||
|---|---|
| `callback` | `GnssNavigationMessage.Callback`: a `https://developer.android.com/reference/android/location/GnssNavigationMessage.Callback` object to remove. This value cannot be `null`. <br /> |

### unregisterGnssStatusCallback

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void unregisterGnssStatusCallback (GnssStatus.Callback callback)
```

Removes a GNSS status callback.

<br />

| Parameters ||
|---|---|
| `callback` | `GnssStatus.Callback`: GNSS status callback object to remove. This value cannot be `null`. <br /> |