# LocationManagerCompat

# LocationManagerCompat

Artifact:[androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core)  
[View Source](https://cs.android.com/search?q=file:androidx/core/location/LocationManagerCompat.java+class:androidx.core.location.LocationManagerCompat)  
Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/core/location/LocationManagerCompat "View this page in Java")

<br />

```
class LocationManagerCompat
```

<br />

*** ** * ** ***

Helper for accessing features in[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html).

## Summary

|                                        ### Public functions                                        |
|----------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(anyOf = )` [getCurrentLocation](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getCurrentLocation(android.location.LocationManager,java.lang.String,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.core.util.Consumer<android.location.Location>))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` provider: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` cancellationSignal: `[CancellationSignal](https://developer.android.com/reference/android/os/CancellationSignal.html)`?,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`,` ` consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[Location](https://developer.android.com/reference/android/location/Location.html)`!>` `)` Asynchronously returns a single current location fix from the given provider.                                                                                                                                                                                                                                                                                           |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(anyOf = )` ~~[getCurrentLocation](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getCurrentLocation(android.location.LocationManager,java.lang.String,androidx.core.os.CancellationSignal,java.util.concurrent.Executor,androidx.core.util.Consumer<android.location.Location>))~~`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` provider: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` cancellationSignal: `[CancellationSignal](https://developer.android.com/reference/kotlin/androidx/core/os/CancellationSignal)`?,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`,` ` consumer: `[Consumer](https://developer.android.com/reference/kotlin/androidx/core/util/Consumer)`<`[Location](https://developer.android.com/reference/android/location/Location.html)`!>` `)` **This function is deprecated.** Use[getCurrentLocation](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getCurrentLocation(android.location.LocationManager,java.lang.String,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.core.util.Consumer<android.location.Location>)) <br /> |
| `java-static `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` | [getGnssHardwareModelName](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getGnssHardwareModelName(android.location.LocationManager))`(locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`)` Returns the model name (including vendor and hardware/software version) of the GNSS hardware driver, or null if this information is not available.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)          | [getGnssYearOfHardware](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getGnssYearOfHardware(android.location.LocationManager))`(locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`)` Returns the model year of the GNSS hardware and software build, or 0 if the model year is before 2016.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [hasProvider](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#hasProvider(android.location.LocationManager,java.lang.String))`(locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`, provider: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Returns true if the given location provider exists on this device, irrespective of whether it is currently enabled or not.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | [isLocationEnabled](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#isLocationEnabled(android.location.LocationManager))`(locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`)` Returns the current enabled/disabled state of location.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = `[VERSION_CODES.N](https://developer.android.com/reference/android/os/VERSION_CODES.html#N)`)` `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(value = "android.permission.ACCESS_FINE_LOCATION")` [registerGnssMeasurementsCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#registerGnssMeasurementsCallback(android.location.LocationManager,android.location.GnssMeasurementsEvent.Callback,android.os.Handler))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` callback: `[GnssMeasurementsEvent.Callback](https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback.html)`,` ` handler: `[Handler](https://developer.android.com/reference/android/os/Handler.html) `)` Registers a GNSS measurement callback.                                                                                                                                                                                                                                                                                                                                                                                                                 |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = `[VERSION_CODES.N](https://developer.android.com/reference/android/os/VERSION_CODES.html#N)`)` `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(value = "android.permission.ACCESS_FINE_LOCATION")` [registerGnssMeasurementsCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#registerGnssMeasurementsCallback(android.location.LocationManager,java.util.concurrent.Executor,android.location.GnssMeasurementsEvent.Callback))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`,` ` callback: `[GnssMeasurementsEvent.Callback](https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback.html) `)` Registers a GNSS measurement callback.                                                                                                                                                                                                                                                                                                                                                                                         |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(value = "android.permission.ACCESS_FINE_LOCATION")` [registerGnssStatusCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#registerGnssStatusCallback(android.location.LocationManager,androidx.core.location.GnssStatusCompat.Callback,android.os.Handler))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` callback: `[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback)`,` ` handler: `[Handler](https://developer.android.com/reference/android/os/Handler.html) `)` Registers a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `java-static `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)  | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(value = "android.permission.ACCESS_FINE_LOCATION")` [registerGnssStatusCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#registerGnssStatusCallback(android.location.LocationManager,java.util.concurrent.Executor,androidx.core.location.GnssStatusCompat.Callback))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`,` ` callback: `[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback) `)` Registers a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(anyOf = )` [removeUpdates](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#removeUpdates(android.location.LocationManager,androidx.core.location.LocationListenerCompat))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` listener: `[LocationListenerCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationListenerCompat) `)` Removes all location updates for the specified[LocationListener](https://developer.android.com/reference/android/location/LocationListener.html).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(anyOf = )` [requestLocationUpdates](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#requestLocationUpdates(android.location.LocationManager,java.lang.String,androidx.core.location.LocationRequestCompat,java.util.concurrent.Executor,androidx.core.location.LocationListenerCompat))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` provider: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` locationRequest: `[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat)`,` ` executor: `[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html)`,` ` listener: `[LocationListenerCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationListenerCompat) `)` Register for location updates from the specified provider, using a[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat), and a callback on the specified[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html).                                                                                     |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresPermission](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresPermission)`(anyOf = )` [requestLocationUpdates](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#requestLocationUpdates(android.location.LocationManager,java.lang.String,androidx.core.location.LocationRequestCompat,androidx.core.location.LocationListenerCompat,android.os.Looper))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` provider: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` locationRequest: `[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat)`,` ` listener: `[LocationListenerCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationListenerCompat)`,` ` looper: `[Looper](https://developer.android.com/reference/android/os/Looper.html) `)` Register for location updates from the specified provider, using a[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat), and a callback on the specified[Looper](https://developer.android.com/reference/android/os/Looper.html).                                                                                                                               |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | `@`[RequiresApi](https://developer.android.com/reference/kotlin/androidx/annotation/RequiresApi)`(value = `[VERSION_CODES.N](https://developer.android.com/reference/android/os/VERSION_CODES.html#N)`)` [unregisterGnssMeasurementsCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#unregisterGnssMeasurementsCallback(android.location.LocationManager,android.location.GnssMeasurementsEvent.Callback))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` callback: `[GnssMeasurementsEvent.Callback](https://developer.android.com/reference/android/location/GnssMeasurementsEvent.Callback.html) `)` Unregisters a GNSS measurement callback.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `java-static `[Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)        | [unregisterGnssStatusCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#unregisterGnssStatusCallback(android.location.LocationManager,androidx.core.location.GnssStatusCompat.Callback))`(` ` locationManager: `[LocationManager](https://developer.android.com/reference/android/location/LocationManager.html)`,` ` callback: `[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback) `)` Unregisters a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |

## Public functions

### getCurrentLocation

Added in[1.13.0](https://developer.android.com/jetpack/androidx/releases/core#1.13.0)  

```
@RequiresPermission(anyOf = )
java-static fun getCurrentLocation(
    locationManager: LocationManager,
    provider: String,
    cancellationSignal: CancellationSignal?,
    executor: Executor,
    consumer: Consumer<Location!>
): Unit
```

Asynchronously returns a single current location fix from the given provider. This may activate sensors in order to compute a new location. 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[CancellationSignal](https://developer.android.com/reference/android/os/CancellationSignal.html). 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.  

### getCurrentLocation

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  
Deprecated in[1.13.0](https://developer.android.com/jetpack/androidx/releases/core#1.13.0)  

```
@RequiresPermission(anyOf = )
java-static fun [getCurrentLocation](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getCurrentLocation(android.location.LocationManager,java.lang.String,androidx.core.os.CancellationSignal,java.util.concurrent.Executor,androidx.core.util.Consumer<android.location.Location>))(
    locationManager: LocationManager,
    provider: String,
    cancellationSignal: CancellationSignal?,
    executor: Executor,
    consumer: Consumer<Location!>
): Unit
```
| **This function is deprecated.**   
|
| Use[getCurrentLocation](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#getCurrentLocation(android.location.LocationManager,java.lang.String,android.os.CancellationSignal,java.util.concurrent.Executor,androidx.core.util.Consumer<android.location.Location>))

Asynchronously returns a single current location fix from the given provider. This may activate sensors in order to compute a new location. 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[CancellationSignal](https://developer.android.com/reference/android/os/CancellationSignal.html). 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.  

### getGnssHardwareModelName

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
java-static fun getGnssHardwareModelName(locationManager: LocationManager): String?
```

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.  

### getGnssYearOfHardware

Added in[1.6.0](https://developer.android.com/jetpack/androidx/releases/core#1.6.0)  

```
java-static fun getGnssYearOfHardware(locationManager: LocationManager): Int
```

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

### hasProvider

Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)  

```
java-static fun hasProvider(locationManager: LocationManager, provider: String): Boolean
```

Returns true if the given location provider exists on this device, irrespective of whether it is currently enabled or not. If called on Android Q and below for the[FUSED_PROVIDER](https://developer.android.com/reference/android/location/LocationManager.html#FUSED_PROVIDER()), this method may return incorrect results if the client does not hold at least the[ACCESS_COARSE_LOCATION](https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_COARSE_LOCATION())permission.  

### isLocationEnabled

Added in[1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)  

```
java-static fun isLocationEnabled(locationManager: LocationManager): Boolean
```

Returns the current enabled/disabled state of location.

NOTE: Calling this method on API levels prior to 20*may* require the[ACCESS_FINE_LOCATION](https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_FINE_LOCATION())or[ACCESS_COARSE_LOCATION](https://developer.android.com/reference/android/Manifest.permission.html#ACCESS_COARSE_LOCATION())permission if run on non-standard Android devices. The vast majority of devices should not require either permission to be present for this method.  

|                                       Returns                                       |
|-------------------------------------------------------------------------------------|---------------------------------------------------------------|
| [Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | `true`if location is enabled or`false`if location is disabled |

### registerGnssMeasurementsCallback

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
@RequiresApi(value = VERSION_CODES.N)
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
java-static fun registerGnssMeasurementsCallback(
    locationManager: LocationManager,
    callback: GnssMeasurementsEvent.Callback,
    handler: Handler
): Boolean
```

Registers a GNSS measurement callback. See[registerGnssMeasurementsCallback](https://developer.android.com/reference/android/location/LocationManager.html#registerGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback, android.os.Handler)).

The primary purpose for this compatibility method is to help avoid crashes when delivering GNSS measurements to client on Android R. This bug was fixed in Android R QPR1, but since it's possible not all Android R devices have upgraded to QPR1, this compatibility method is provided to ensure GNSS measurements can be delivered successfully on all platforms.  

### registerGnssMeasurementsCallback

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
@RequiresApi(value = VERSION_CODES.N)
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
java-static fun registerGnssMeasurementsCallback(
    locationManager: LocationManager,
    executor: Executor,
    callback: GnssMeasurementsEvent.Callback
): Boolean
```

Registers a GNSS measurement callback. See[registerGnssMeasurementsCallback](https://developer.android.com/reference/android/location/LocationManager.html#registerGnssMeasurementsCallback(java.util.concurrent.Executor, android.location.GnssMeasurementsEvent.Callback)).

In addition to allowing the use of Executors on older platforms, this compatibility method also helps avoid crashes when delivering GNSS measurements to clients on Android R. This bug was fixed in Android R QPR1, but since it's possible not all Android R devices have upgraded to QPR1, this compatibility method is provided to ensure GNSS measurements can be delivered successfully on all platforms.  

### registerGnssStatusCallback

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
java-static fun registerGnssStatusCallback(
    locationManager: LocationManager,
    callback: GnssStatusCompat.Callback,
    handler: Handler
): Boolean
```

Registers a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback). See[addGpsStatusListener](https://developer.android.com/reference/android/location/LocationManager.html#addGpsStatusListener(android.location.GpsStatus.Listener))and[registerGnssStatusCallback](https://developer.android.com/reference/android/location/LocationManager.html#registerGnssStatusCallback(android.location.GnssStatus.Callback, android.os.Handler)).  

|                                                                                                                               See also                                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [registerGnssStatusCallback](https://developer.android.com/reference/kotlin/androidx/core/location/LocationManagerCompat#registerGnssStatusCallback(android.location.LocationManager,java.util.concurrent.Executor,androidx.core.location.GnssStatusCompat.Callback)) |   |

### registerGnssStatusCallback

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
@RequiresPermission(value = "android.permission.ACCESS_FINE_LOCATION")
java-static fun registerGnssStatusCallback(
    locationManager: LocationManager,
    executor: Executor,
    callback: GnssStatusCompat.Callback
): Boolean
```

Registers a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback). See[addGpsStatusListener](https://developer.android.com/reference/android/location/LocationManager.html#addGpsStatusListener(android.location.GpsStatus.Listener))and[registerGnssStatusCallback](https://developer.android.com/reference/android/location/LocationManager.html#registerGnssStatusCallback(java.util.concurrent.Executor, android.location.GnssStatus.Callback)).

Internally, this API will always utilize GnssStatus APIs and instances on Android N and above, and will always utilize GpsStatus APIs and instances below Android N. Callbacks will always occur on the given executor.

If invoked on Android M or below, this will result in GpsStatus registration being run on either the current Looper or main Looper. If the thread this function is invoked on is different from that Looper, the caller must ensure that the Looper thread cannot be blocked by the thread this function is invoked on. The easiest way to avoid this is to ensure this function is invoked on a Looper thread.  

|                                                     Throws                                                      |
|-----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| [java.lang.IllegalStateException](https://developer.android.com/reference/java/lang/IllegalStateException.html) | on Android M or below, if the current Looper or main Looper is blocked by the thread this function is invoked on |

### removeUpdates

Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)  

```
@RequiresPermission(anyOf = )
java-static fun removeUpdates(
    locationManager: LocationManager,
    listener: LocationListenerCompat
): Unit
```

Removes all location updates for the specified[LocationListener](https://developer.android.com/reference/android/location/LocationListener.html).

See[removeUpdates](https://developer.android.com/reference/android/location/LocationManager.html#removeUpdates(android.location.LocationListener))for more information.  

### requestLocationUpdates

Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)  

```
@RequiresPermission(anyOf = )
java-static fun requestLocationUpdates(
    locationManager: LocationManager,
    provider: String,
    locationRequest: LocationRequestCompat,
    executor: Executor,
    listener: LocationListenerCompat
): Unit
```

Register for location updates from the specified provider, using a[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat), and a callback on the specified[Executor](https://developer.android.com/reference/java/util/concurrent/Executor.html).

See[requestLocationUpdates](https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String, android.location.LocationRequest, java.util.concurrent.Executor, android.location.LocationListener))for more information.  

### requestLocationUpdates

Added in[1.7.0](https://developer.android.com/jetpack/androidx/releases/core#1.7.0)  

```
@RequiresPermission(anyOf = )
java-static fun requestLocationUpdates(
    locationManager: LocationManager,
    provider: String,
    locationRequest: LocationRequestCompat,
    listener: LocationListenerCompat,
    looper: Looper
): Unit
```

Register for location updates from the specified provider, using a[LocationRequestCompat](https://developer.android.com/reference/kotlin/androidx/core/location/LocationRequestCompat), and a callback on the specified[Looper](https://developer.android.com/reference/android/os/Looper.html).

See[requestLocationUpdates](https://developer.android.com/reference/android/location/LocationManager.html#requestLocationUpdates(java.lang.String, android.location.LocationRequest, java.util.concurrent.Executor, android.location.LocationListener))for more information.  

### unregisterGnssMeasurementsCallback

Added in[1.9.0](https://developer.android.com/jetpack/androidx/releases/core#1.9.0)  

```
@RequiresApi(value = VERSION_CODES.N)
java-static fun unregisterGnssMeasurementsCallback(
    locationManager: LocationManager,
    callback: GnssMeasurementsEvent.Callback
): Unit
```

Unregisters a GNSS measurement callback. See[unregisterGnssMeasurementsCallback](https://developer.android.com/reference/android/location/LocationManager.html#unregisterGnssMeasurementsCallback(android.location.GnssMeasurementsEvent.Callback)).  

### unregisterGnssStatusCallback

Added in[1.5.0](https://developer.android.com/jetpack/androidx/releases/core#1.5.0)  

```
java-static fun unregisterGnssStatusCallback(
    locationManager: LocationManager,
    callback: GnssStatusCompat.Callback
): Unit
```

Unregisters a platform agnostic[GnssStatusCompat.Callback](https://developer.android.com/reference/kotlin/androidx/core/location/GnssStatusCompat.Callback). See[removeGpsStatusListener](https://developer.android.com/reference/android/location/LocationManager.html#removeGpsStatusListener(android.location.GpsStatus.Listener))and[unregisterGnssStatusCallback](https://developer.android.com/reference/android/location/LocationManager.html#unregisterGnssStatusCallback(android.location.GnssStatus.Callback)).