# Main configurations

## **Vehicle Type**

The UI vehicle module allows the selection of two vehicle types: (1) cars and (2) trucks.\
The selection of user-configurable vehicle types is performed via the `VehicleType` enum.

You can define the vehicle types to be used by calling the following method:

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

```kotlin
val vehiclesTypes = listOf(VehicleType.CAR, VehicleType.TRUCK)
       DriveKitVehicleUI.configureVehiclesTypes(vehiclesTypes)
```

{% endtab %}

{% tab title="Java" %}

```java
List<VehicleType> vehiclesTypes = Arrays.asList(VehicleType.CAR, VehicleType.TRUCK);
DriveKitVehicleUI.INSTANCE.configureVehiclesTypes(vehiclesTypes);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `CAR`
* `TRUCK`

**Default value:** \[`CAR`, `TRUCK`]

## **Vehicle selection mode**

DriveKit Vehicle UI allows you to choose between two types of vehicle selection modes with the `categoryConfigType` variable.

![Method to select a generic vehicle from its category](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FBxWtijwZUIIycNUqsMUT%2Fimage.png?alt=media\&token=820953a2-7be0-4dc9-87da-8a26dcecb08e)

![Method to select a vehicle from its brand, version and model](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FXnARkW4aDEGdlRXgl8pn%2Fimage.png?alt=media\&token=11441063-3d00-435a-a088-2ba762b22fa0)

You can choose which mode you want to use by calling the following method:

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

```kotlin
val categoryConfigType = CategoryConfigType.BOTH_CONFIG
DriveKitVehicleUI.configureCategoryConfigType(categoryConfigType)
```

{% endtab %}

{% tab title="Java" %}

```java
CategoryConfigType categoryConfigType = CategoryConfigType.BOTH_CONFIG;
DriveKitVehicleUI.INSTANCE.configureCategoryConfigType(categoryConfigType);
```

{% endtab %}
{% endtabs %}

**Settings:**

* `LITE_CONFIG_ONLY`: the driver simply selects a default vehicle model corresponding to a category (city car, sedan, utility vehicle, etc.). The characteristics of the vehicle will be those of a default model chosen to represent this vehicle category.
* `BRANDS_CONFIG_ONLY`: the process of adding a vehicle includes more steps that lead to the exact selection of the user's vehicle.
* `BOTH_CONFIG`: both modes are available to the user. The user starts by selecting a vehicle category. If he wishes, he can stop at this stage, otherwise he can proceed with the other steps.

\
**Default value:** `BOTH_CONFIG`

## **Selection of the auto start mode**

The SDK allows 4 configurations for the automatic start of the trip analysis. This configuration is controlled via `DetectionMode`.

You can choose which detection mode(s) to display by calling the following method:

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

```kotlin
DriveKitVehicleUI.configureDetectionModes(
    listOf(DetectionMode.DISABLED, DetectionMode.GPS, DetectionMode.BEACON, DetectionMode.BLUETOOTH)
)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.configureDetectionModes(
   Arrays.asList(DetectionMode.DISABLED, DetectionMode.GPS, DetectionMode.BEACON, DetectionMode.BLUETOOTH)
);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `DISABLED`
* `GPS`
* `BEACON`
* `BLUETOOTH`

**Default value**: \[ `DISABLED`, `GPS`, `BEACON`, `BLUETOOTH` ]

## Vehicle mileage tracking and editing

The vehicle UI component includes a simple and powerful feature to automatically track vehicle mileage and manually add a mileage record. The mileage computation is based on the sum of the trip distances for all the trips recorded automatically.&#x20;

If some trips are lost or if you notice a difference between the mileage measured by the SDK and the mileage displayed on the vehicle's odometer, it is possible to correct the value and manually add the real value.

![](https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FcbaHcZhcC5NJG3lo8qpD%2Fimage.png?alt=media\&token=01b8f86a-bf23-4b3b-a28e-d79fe072800b)

### Enable mileage tracking

By default, the mileage tracking feature is disabled, if you wish to enable it, simply use the method below:

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

```kotlin
DriveKitVehicleUI.enableOdometer(hasOdometer : Boolean)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.Companion.enableOdometer(hasOdometer : Boolean)
```

{% endtab %}
{% endtabs %}

### Display mileage tracking

To include the vehicle odometer component, you need to use the following method:

```kotlin
startOdometerUIActivity(activity: Activity, vehicleId:String? = null)
```

If you just want to display the odometer component with default configuration you can use the following metho&#x64;**:**

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

```kotlin
DriveKitVehicleUI.startOdometerUIActivity(activity)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.startOdometerUIActivity(activity, null)
```

{% endtab %}
{% endtabs %}

If you want to display a particular vehicle odometer, add vehicleId as a parameter.

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

```kotlin
DriveKitVehicleUI.startOdometerUIActivity(activity, "vehicleId")
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.startOdometerUIActivity(activity, "vehicleId")
```

{% endtab %}
{% endtabs %}

## Find my vehicle

The **Vehicle** component includes a feature that helps users easily find where they parked their vehicle. It displays the user’s current location alongside the vehicle’s last known location and, if needed, offers to launch a route from the user’s current position to the vehicle using their preferred navigation app.

\
This feature uses the [`getVehicleLocation()`](https://docs.drivequant.com/android/vehicle-management#get-vehicle-last-location) method from the Vehicle component to retrieve the vehicle’s last known location.

<figure><img src="https://2525923625-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LXYIG5U3AO65YYFWJRK%2Fuploads%2FJkpQskHUIA2PgQTS8yjR%2FFind%20My%20Vehicle%20-%20Public%20doc%20-%20Android.png?alt=media&#x26;token=ec3e35ab-a6db-4f39-82fb-75ec010dd5d2" alt=""><figcaption></figcaption></figure>

To display the “Find my vehicle” screen into your app, call the following method:

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

```kotlin
DriveKitVehicleUI.startFindMyVehicleActivity(context, "myVehicleId")
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.startFindMyVehicleActivity(context, "myVehicleId");
```

{% endtab %}
{% endtabs %}

If you don’t have a vehicle identifier, you can also get the location of the latest used vehicle. This feature uses [`getLastVehicleTripLocation()`](https://docs.drivequant.com/trip-analysis/android/trip-management#get-last-vehicle-trip-location) method from TripAnalysis module

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

```kotlin
DriveKitVehicleUI.startFindMyVehicleActivity(context)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.startFindMyVehicleActivity(context);
```

{% endtab %}
{% endtabs %}
