# Mileage

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/hardware/info/Mileage.java+class:androidx.car.app.hardware.info.Mileage) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0)

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 3)
class Mileage
```

<br />

*** ** * ** ***

Information about car mileage.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage.Builder` A builder of `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage`. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarValue<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getDistanceDisplayUnit()()` Returns the distance display unit from the car hardware. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarValue<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()()` Returns the value of the odometer from the car hardware in kilometers. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarValue<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html!>` | `[getOdometerMeters](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getOdometerMeters())()` **This function is deprecated.** use `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()` which does the same as this method, except that the correct units are in the API name <br /> |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#toString()()` |

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### getDistanceDisplayUnit

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

```
fun getDistanceDisplayUnit(): CarValue<Int!>
```

Returns the distance display unit from the car hardware.

See `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/common/CarUnit` for possible distance values.

### getOdometerInKilometers

Added in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun getOdometerInKilometers(): CarValue<Float!>
```

Returns the value of the odometer from the car hardware in kilometers. The precision of this value depends on the hardware implementation. Some vehicles may return whole kilomters, while others may return down to tenths or hundredths of a kilometer.

### getOdometerMeters

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.1.0) Deprecated in [1.8.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.8.0)

```
fun [getOdometerMeters](https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getOdometerMeters())(): CarValue<Float!>
```

> [!CAUTION]
> **This function is deprecated.**   
>
> use `https://developer.android.com/reference/kotlin/androidx/car/app/hardware/info/Mileage#getOdometerInKilometers()` which does the same as this method, except that the correct units are in the API name

Returns the value of the odometer from the car hardware in KILOMETERS. Despite the name "meters", this method actually returns the odometer in kilometers. It was incorrectly introduced as meters and due to backwards compatibility concerns, can no longer be renamed or removed.

### hashCode

```
fun hashCode(): Int
```

### toString

```
fun toString(): String
```