# Odometer

## Synchronize vehicle's odometer

You can retrieve the vehicle’s odometer data from the DriveQuant servers by calling the following method:

{% tabs %}
{% tab title="DriveKitVehicle" %}

```kotlin
fun getOdometer(
    	vehicleId: String,
    	listener: OdometerSyncQueryListener,
    	type: SynchronizationType = DEFAULT
)
```

{% endtab %}
{% endtabs %}

This method have the following parameters:

| Name      | Type                | Description                                                                                                                                                                                                                                                             |
| --------- | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| vehicleId | String              | The vehicle for which you want to get the odometer’s data                                                                                                                                                                                                               |
| type      | SynchronizationType | <p>Can be <code>DEFAULT</code> or <code>CACHE</code>.</p><p>- <code>DEFAULT</code> will synchronize the vehicle’s odometer by calling the DriveQuant servers</p><p>- <code>CACHE</code> will retrieve the odometer data already synchronized in the local database.</p> |

[OdometerSyncStatus](/vehicle/android/references-android.md#odometersyncstatus),  [VehicleOdometer](/vehicle/android/references-android.md#vehicleodometer) and [VehicleOdometerHistory](/vehicle/android/references-android.md#vehicleodometerhistory) models are described in the References part.

## Retrieve local vehicle’s odometer data

You can retrieve the vehicle’s odometer data stored in the DriveKit local database by calling the previous method but with the type parameter to `CACHE`.

## Add odometer history

You can add a new entry to a vehicle’s odometer by calling the following method:

{% tabs %}
{% tab title="DriveKitVehicle" %}

```kotlin
fun addOdometerHistory(
    	vehicleId: String,
    	distance: Double,
    	listener: OdometerAddHistoryQueryListener
)
```

{% endtab %}
{% endtabs %}

This method have the following parameters:

| Name      | type   | Description                                               |
| --------- | ------ | --------------------------------------------------------- |
| vehicleId | String | The vehicle id for which you want to add an history entry |
| distance  | Double | The distance in km you want to set                        |

[OdometerAddHistoryStatus](/vehicle/android/references-android.md#odometeraddhistorystatus),  [VehicleOdometer](/vehicle/android/references-android.md#vehicleodometer) and [VehicleOdometerHistory](/vehicle/android/references-android.md#vehicleodometerhistory) models are described in the References part.

## Update odometer history

To update an entry to a vehicle’s odometer, call the following method:

{% tabs %}
{% tab title="DriveKitVehicle" %}

```kotlin
fun updateOdometerHistory(
    	vehicleId: String,
    	historyId: Int,
    	distance: Double,
    	listener: OdometerUpdateHistoryQueryListener
)
```

{% endtab %}
{% endtabs %}

This method have the following parameters:

| Name      | Type   | Description                                                     |
| --------- | ------ | --------------------------------------------------------------- |
| vehicleId | String | The vehicle id for which you want to update the odometer’s data |
| historyId | Int    | The history id for which you want to update the distance.       |
| distance  | Double | The distance in km you want to update                           |

[OdometerUpdateHistoryStatus](/vehicle/android/references-android.md#odometerupdatehistorystatus),  [VehicleOdometer](/vehicle/android/references-android.md#vehicleodometer) and [VehicleOdometerHistory](/vehicle/android/references-android.md#vehicleodometerhistory) models are described in the References part.

## Delete odometer history

To delete vehicle’s odometer entry, call the following method:

{% tabs %}
{% tab title="DriveKitVehicle" %}

```kotlin
fun deleteOdometerHistory(
    	vehicleId: String,
    	historyId: Int,
    	listener: OdometerDeleteHistoryQueryListener
)
```

{% endtab %}
{% endtabs %}

This method have the following parameters:

| Name      | Type   | Description                                                              |
| --------- | ------ | ------------------------------------------------------------------------ |
| vehicleId | String | The vehicle id for which you want to delete the odometer’s history entry |
| historyId | Int    | The history id you want to delete                                        |

[OdometerDeleteHistoryStatus](/vehicle/android/references-android.md#odometerdeletehistorystatus),  [VehicleOdometer](/vehicle/android/references-android.md#vehicleodometer) and [VehicleOdometerHistory](/vehicle/android/references-android.md#vehicleodometerhistory) models are described in the References part.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.drivequant.com/vehicle/android/odometer.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
