# LocationCompat

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

*** ** * ** ***

<br />

```
class LocationCompat
```

<br />

*** ** * ** ***

Helper for accessing features in `https://developer.android.com/reference/android/location/Location.html`.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_BEARING_ACCURACY() = "bearingAccuracy"` Constant used as a key to store bearing accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_IS_MOCK() = "mockLocation"` Constant used as a key to store mock location status in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below JBMR2 (18). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE() = "androidx.core.location.extra.MSL_ALTITUDE"` Constant used as a key to store Mean Sea Level altitude in `https://developer.android.com/reference/android/location/Location.html#getExtras()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE_ACCURACY() = "androidx.core.location.extra.MSL_ALTITUDE_ACCURACY"` Constant used as a key to store Mean Sea Level altitude in `https://developer.android.com/reference/android/location/Location.html#getExtras()`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_SPEED_ACCURACY() = "speedAccuracy"` Constant used as a key to store speed accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26). |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_VERTICAL_ACCURACY() = "verticalAccuracy"` Constant used as a key to store vertical accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26). |

| ### Public functions |
|---|---|
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getBearingAccuracyDegrees(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Get the estimated bearing accuracy of this location in degrees. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getElapsedRealtimeMillis(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Return the time of this fix, in milliseconds of elapsed real-time since system boot. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `@https://developer.android.com/reference/kotlin/androidx/annotation/ReplaceWith(expression = "location.getElapsedRealtimeNanos()") [getElapsedRealtimeNanos](https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getElapsedRealtimeNanos(android.location.Location))(location: https://developer.android.com/reference/android/location/Location.html)` **This function is deprecated.** Call `https://developer.android.com/reference/android/location/Location.html#getElapsedRealtimeNanos()` directly. <br /> |
| `java-static @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getMslAltitudeAccuracyMeters(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns the estimated Mean Sea Level altitude accuracy in meters of the location at the 68th percentile confidence level. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getMslAltitudeMeters(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns the Mean Sea Level altitude of the location in meters. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getSpeedAccuracyMetersPerSecond(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Get the estimated speed accuracy of this location in meters per second. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getVerticalAccuracyMeters(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Get the estimated vertical accuracy of this location in meters. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasBearingAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if this location has a bearing accuracy. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasMslAltitude(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if the location has a Mean Sea Level altitude, false otherwise. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasMslAltitudeAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if the location has a Mean Sea Level altitude accuracy, false otherwise. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasSpeedAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if this location has a speed accuracy. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasVerticalAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if this location has a vertical accuracy. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#isMock(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Returns true if this location is marked as a mock location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#removeBearingAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Removes the bearing accuracy from the location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#removeMslAltitude(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Removes the Mean Sea Level altitude from the location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#removeMslAltitudeAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Removes the Mean Sea Level altitude accuracy from the location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#removeSpeedAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Removes the speed accuracy from the location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#removeVerticalAccuracy(android.location.Location)(location: https://developer.android.com/reference/android/location/Location.html)` Removes the vertical accuracy from the location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setBearingAccuracyDegrees(android.location.Location,float)(location: https://developer.android.com/reference/android/location/Location.html, bearingAccuracyD: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the estimated bearing accuracy of this location in degrees. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setMock(android.location.Location,boolean)(location: https://developer.android.com/reference/android/location/Location.html, mock: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Sets whether this location is marked as a mock location. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setMslAltitudeAccuracyMeters(android.location.Location,float)( location: https://developer.android.com/reference/android/location/Location.html, mslAltitudeAccuracyMeters: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Sets the Mean Sea Level altitude accuracy of the location in meters. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setMslAltitudeMeters(android.location.Location,double)(location: https://developer.android.com/reference/android/location/Location.html, mslAltitudeMeters: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html)` Sets the Mean Sea Level altitude of the location in meters. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setSpeedAccuracyMetersPerSecond(android.location.Location,float)( location: https://developer.android.com/reference/android/location/Location.html, speedAccuracyMps: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Set the estimated speed accuracy of this location in meters per second. |
| `java-static https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#setVerticalAccuracyMeters(android.location.Location,float)(location: https://developer.android.com/reference/android/location/Location.html, verticalAccuracyM: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the estimated vertical accuracy of this location in meters. |

## Constants

### EXTRA_BEARING_ACCURACY

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

```
const val EXTRA_BEARING_ACCURACY = "bearingAccuracy": String!
```

Constant used as a key to store bearing accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26).

### EXTRA_IS_MOCK

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

```
const val EXTRA_IS_MOCK = "mockLocation": String!
```

Constant used as a key to store mock location status in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below JBMR2 (18).

### EXTRA_MSL_ALTITUDE

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

```
const val EXTRA_MSL_ALTITUDE = "androidx.core.location.extra.MSL_ALTITUDE": String!
```

Constant used as a key to store Mean Sea Level altitude in `https://developer.android.com/reference/android/location/Location.html#getExtras()`.

### EXTRA_MSL_ALTITUDE_ACCURACY

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

```
const val EXTRA_MSL_ALTITUDE_ACCURACY = "androidx.core.location.extra.MSL_ALTITUDE_ACCURACY": String!
```

Constant used as a key to store Mean Sea Level altitude in `https://developer.android.com/reference/android/location/Location.html#getExtras()`.

### EXTRA_SPEED_ACCURACY

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

```
const val EXTRA_SPEED_ACCURACY = "speedAccuracy": String!
```

Constant used as a key to store speed accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26).

### EXTRA_VERTICAL_ACCURACY

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

```
const val EXTRA_VERTICAL_ACCURACY = "verticalAccuracy": String!
```

Constant used as a key to store vertical accuracy in `https://developer.android.com/reference/android/location/Location.html#getExtras()` for Android SDK levels below Oreo (26).

## Public functions

### getBearingAccuracyDegrees

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

```
java-static fun getBearingAccuracyDegrees(location: Location): Float
```

Get the estimated bearing accuracy of this location in degrees.

NOTE: On API levels below 26, the concept of bearing accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to read a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_BEARING_ACCURACY()` and return the result.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#getBearingAccuracyDegrees()` |   |

### getElapsedRealtimeMillis

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

```
java-static fun getElapsedRealtimeMillis(location: Location): Long
```

Return the time of this fix, in milliseconds of elapsed real-time since system boot.

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getElapsedRealtimeNanos(android.location.Location)` |   |

### getElapsedRealtimeNanos

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

```
@ReplaceWith(expression = "location.getElapsedRealtimeNanos()")
java-static fun [getElapsedRealtimeNanos](https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getElapsedRealtimeNanos(android.location.Location))(location: Location): Long
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Call `https://developer.android.com/reference/android/location/Location.html#getElapsedRealtimeNanos()` directly.

Return the time of this fix, in nanoseconds of elapsed real-time since system boot.

This value can be reliably compared to SystemClock.elapsedRealtimeNanos(), to calculate the age of a fix and to compare location fixes. This is reliable because elapsed real-time is guaranteed monotonic for each system boot and continues to increment even when the system is in deep sleep (unlike getTime().

All locations generated by the LocationManager are guaranteed to have a valid elapsed real-time.

### getMslAltitudeAccuracyMeters

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

```
java-static fun getMslAltitudeAccuracyMeters(location: Location): @FloatRange(from = 0.0) Float
```

Returns the estimated Mean Sea Level altitude accuracy in meters of the location at the 68th percentile confidence level. This means that there is 68% chance that the true Mean Sea Level altitude of the location falls within `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#getMslAltitudeMeters(android.location.Location)` +/- this uncertainty.

This is only valid if `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasMslAltitudeAccuracy(android.location.Location)` is true.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to read a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE_ACCURACY()` and return the result.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#getMslAltitudeAccuracyMeters()` |   |

### getMslAltitudeMeters

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

```
java-static fun getMslAltitudeMeters(location: Location): Double
```

Returns the Mean Sea Level altitude of the location in meters.

This is only valid if `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#hasMslAltitude(android.location.Location)` is true.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to read a double extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE()` and return the result.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#getMslAltitudeMeters()` |   |

### getSpeedAccuracyMetersPerSecond

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

```
java-static fun getSpeedAccuracyMetersPerSecond(location: Location): Float
```

Get the estimated speed accuracy of this location in meters per second.

NOTE: On API levels below 26, the concept of speed accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to read a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_SPEED_ACCURACY()` and return the result.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#getSpeedAccuracyMetersPerSecond()` |   |

### getVerticalAccuracyMeters

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

```
java-static fun getVerticalAccuracyMeters(location: Location): Float
```

Get the estimated vertical accuracy of this location in meters.

NOTE: On API levels below 26, the concept of vertical accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to read a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_VERTICAL_ACCURACY()` and return the result.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#getVerticalAccuracyMeters()` |   |

### hasBearingAccuracy

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

```
java-static fun hasBearingAccuracy(location: Location): Boolean
```

Returns true if this location has a bearing accuracy.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#hasBearingAccuracy()` |   |

### hasMslAltitude

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

```
java-static fun hasMslAltitude(location: Location): Boolean
```

Returns true if the location has a Mean Sea Level altitude, false otherwise.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude does not exist. In order to allow for backwards compatibility and testing however, this method will return true if an extra value is with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE()`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#hasMslAltitude()` |   |

### hasMslAltitudeAccuracy

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

```
java-static fun hasMslAltitudeAccuracy(location: Location): Boolean
```

Returns true if the location has a Mean Sea Level altitude accuracy, false otherwise.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will return true if an extra value is with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE_ACCURACY()`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#hasMslAltitudeAccuracy()` |   |

### hasSpeedAccuracy

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

```
java-static fun hasSpeedAccuracy(location: Location): Boolean
```

Returns true if this location has a speed accuracy.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#hasSpeedAccuracy()` |   |

### hasVerticalAccuracy

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

```
java-static fun hasVerticalAccuracy(location: Location): Boolean
```

Returns true if this location has a vertical accuracy.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#hasVerticalAccuracy()` |   |

### isMock

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

```
java-static fun isMock(location: Location): Boolean
```

Returns true if this location is marked as a mock location. If this location comes from the Android framework, this indicates that the location was provided by a test location provider, and thus may not be related to the actual location of the device.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/LocationManager.html#addTestProvider(java.lang.String, android.location.provider.ProviderProperties)` |   |

### removeBearingAccuracy

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

```
java-static fun removeBearingAccuracy(location: Location): Unit
```

Removes the bearing accuracy from the location.

### removeMslAltitude

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

```
java-static fun removeMslAltitude(location: Location): Unit
```

Removes the Mean Sea Level altitude from the location.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to remove any extra value with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE()`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#removeMslAltitude()` |   |

### removeMslAltitudeAccuracy

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

```
java-static fun removeMslAltitudeAccuracy(location: Location): Unit
```

Removes the Mean Sea Level altitude accuracy from the location.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to remove any extra value with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE_ACCURACY()`.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#removeMslAltitudeAccuracy()` |   |

### removeSpeedAccuracy

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

```
java-static fun removeSpeedAccuracy(location: Location): Unit
```

Removes the speed accuracy from the location.

### removeVerticalAccuracy

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

```
java-static fun removeVerticalAccuracy(location: Location): Unit
```

Removes the vertical accuracy from the location.

### setBearingAccuracyDegrees

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

```
java-static fun setBearingAccuracyDegrees(location: Location, bearingAccuracyD: Float): Unit
```

Set the estimated bearing accuracy of this location in degrees.

NOTE: On API levels below 26, the concept of bearing accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to set a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_BEARING_ACCURACY()` to include bearing accuracy. Be aware that this will overwrite any prior extra value under the same key.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#setBearingAccuracyDegrees(float)` |   |

### setMock

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

```
java-static fun setMock(location: Location, mock: Boolean): Unit
```

Sets whether this location is marked as a mock location.

### setMslAltitudeAccuracyMeters

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

```
java-static fun setMslAltitudeAccuracyMeters(
    location: Location,
    mslAltitudeAccuracyMeters: @FloatRange(from = 0.0) Float
): Unit
```

Sets the Mean Sea Level altitude accuracy of the location in meters.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to set a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE_ACCURACY()` to include Mean Sea Level altitude accuracy. Be aware that this will overwrite any prior extra value under the same key.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#setMslAltitudeAccuracyMeters(float)` |   |

### setMslAltitudeMeters

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

```
java-static fun setMslAltitudeMeters(location: Location, mslAltitudeMeters: Double): Unit
```

Sets the Mean Sea Level altitude of the location in meters.

NOTE: On API levels below 34, the concept of Mean Sea Level altitude does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to set a double extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_MSL_ALTITUDE()` to include Mean Sea Level altitude. Be aware that this will overwrite any prior extra value under the same key.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#setMslAltitudeMeters(double)` |   |

### setSpeedAccuracyMetersPerSecond

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

```
java-static fun setSpeedAccuracyMetersPerSecond(
    location: Location,
    speedAccuracyMps: Float
): Unit
```

Set the estimated speed accuracy of this location in meters per second.

NOTE: On API levels below 26, the concept of speed accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to set a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_SPEED_ACCURACY()` to include speed accuracy. Be aware that this will overwrite any prior extra value under the same key.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#setSpeedAccuracyMetersPerSecond(float)` |   |

### setVerticalAccuracyMeters

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

```
java-static fun setVerticalAccuracyMeters(location: Location, verticalAccuracyM: Float): Unit
```

Set the estimated vertical accuracy of this location in meters.

NOTE: On API levels below 26, the concept of vertical accuracy does not exist. In order to allow for backwards compatibility and testing however, this method will attempt to set a float extra with the key `https://developer.android.com/reference/kotlin/androidx/core/location/LocationCompat#EXTRA_VERTICAL_ACCURACY()` to include vertical accuracy. Be aware that this will overwrite any prior extra value under the same key.

| See also |
|---|---|
| `https://developer.android.com/reference/android/location/Location.html#setVerticalAccuracyMeters(float)` |   |