# Advanced configurations

## **Maximum number of vehicles**

A user can declare one or more vehicles. If you need to limit the number of configurable vehicle(s), you can set the parameter `maxVehicles`:

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

```kotlin
val maxVehicles = 1
DriveKitVehicleUI.configureMaxVehicles(maxVehicles)
```

{% endtab %}

{% tab title="Java" %}

```java
int maxVehicles = 1;
DriveKitVehicleUI.INSTANCE.configureMaxVehicles(maxVehicles);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* A strictly positive integer
* `null`: If you do not want to limit the number of configurable vehicles.

**Default value:** `null`

## **Authorization to add a vehicle**

In some cases the vehicle can be pre-configured or you do not want the user to add a vehicle himself. Depending on your needs, it is possible to allow or restrict the vehicle to be added by the user. Call the following method to enable/disable the configuration:

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

```kotlin
val canAddVehicle = true
DriveKitVehicleUI.enableAddVehicle(canAddVehicle)
```

{% endtab %}

{% tab title="Java" %}

```java
boolean canAddVehicle = true;
DriveKitVehicleUI.INSTANCE.enableAddVehicle(canAddVehicle);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `true`: the user can add a vehicle
* `false`: the user cannot add a vehicle

**Default value:** `true`

## **Configure vehicle actions**

The Vehicle UI module lets you manage the actions that can be performed by the user on the vehicle.&#x20;

You can select the features that are visible and accessible to the user as well as the order in which these features are displayed. The possible actions are : delete the vehicle, replace the vehicle, rename the vehicle, technical data display and manage the vehicle mileage.

You can select which actions you want to display by calling the following method:

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

```kotlin
DriveKitVehicleUI.configureVehicleActions(
    listOf(VehicleAction.SHOW, VehicleAction.RENAME, VehicleAction.REPLACE, VehicleAction.DELETE, VehicleAction.ODOMETER)
)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.configureVehicleActions(
    Arrays.asList(
        VehicleAction.SHOW,
        VehicleAction.RENAME,
        VehicleAction.REPLACE,
        VehicleAction.DELETE,
        VehicleAction.ODOMETER));
```

{% endtab %}
{% endtabs %}

**Settings:**

* `SHOW`: the user can display the vehicle characteristics.&#x20;
* `RENAME`: the user can rename the vehicle.
* `REPLACE`: the user can replace the vehicle.
* `DELETE`: the user can delete the vehicle.
* `ODOMETER`: the user can enter a mileage value manually.

**Default values:** \[`SHOW`, `RENAME`, `REPLACE`, `DELETE`, `ODOMETER`]

## **Authorization to delete a beacon**

If automatic trip recording with a beacon is mandatory in your application, you can block the deletion of a beacon and only allow its replacement. You can enable or disable this function using the following method:

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

```kotlin
val canRemoveBeacon = true
DriveKitVehicleUI.enableRemoveBeacon(canRemoveBeacon)

```

{% endtab %}

{% tab title="Java" %}

```java
boolean canRemoveBeacon = true;
DriveKitVehicleUI.INSTANCE.enableRemoveBeacon(canRemoveBeacon);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `true`: the user can delete a beacon
* `false`: the user cannot delete a beacon

**Default value:** `true`

## **Select vehicle categories**

The DriveKit Vehicle module contains a default category list (based on vehicle type). It is recommended not to modify this list. If it is strictly necessary, it is possible to remove some values or to change the order of the values in the car category list. You must not modify the value of the fields.

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

```kotlin
DriveKitVehicleUI.configureVehicleCategories(
    listOf(VehicleCategory.MICRO, VehicleCategory.COMPACT, ...)
)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.configureVehicleCategories(
    Arrays.asList(VehicleCategory.MICRO, VehicleCategory.COMPACT, …)
);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

Car:

* `MICRO`
* `COMPACT`
* `SEDAN`
* `SUV`
* `MINIVAN`
* `COMMERCIAL`
* `LUXURY`
* `SPORT`

Truck:

* `TWO_AXLES_STRAIGHT_TRUCK`
* `THREE_AXLES_STRAIGHT_TRUCK`
* `FOUR_AXLES_STRAIGHT_TRUCK`
* `TWO_AXLES_TRACTOR`
* `THREE_AXLES_TRACTOR`
* `FOUR_AXLES_TRACTOR`

**Default values:** All categories are displayed by default (depending on the type).

{% hint style="info" %}
By default, the values are all in the list. They will be displayed depending on the selected types.
{% endhint %}

## **Select brands**

The DriveKit Vehicle module contains a default brand list (based on vehicle category). It is recommended not to modify this list. If it is strictly necessary, it is possible to remove some values or to change the order of the values in this list. You must not modify the value of the fields.&#x20;

You can choose which brands to display by calling the following method:

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

```kotlin
DriveKitVehicleUI.configureBrands(
    listOf(VehicleBrand.ABARTH, VehicleBrand.ALFA_ROMEO, ...)
)
```

{% endtab %}

{% tab title="Java" %}

```java
DriveKitVehicleUI.INSTANCE.configureBrands(
    Arrays.asList(VehicleBrand.ABARTH, VehicleBrand.ALFA_ROMEO, ...)
);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `VehicleBrand` enum values

**Default value:** All brands are displayed by default.<br>

## **Select engine types**

The DriveKit Vehicle module contains a default engine type list (based on vehicle brand). It is recommended not to modify this list. If it is strictly necessary, it is possible to remove some values or to change the order of the values in this list. You must not modify the value of the fields.&#x20;

You can choose which engine type(s) to display by calling the following method:

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

```
DriveKitVehicleUI.configureEngineIndexes(
    listOf(VehicleEngineIndex.GASOLINE, VehicleEngineIndex.DIESEL, ...)
)
```

{% endtab %}

{% tab title="Java" %}

```
DriveKitVehicleUI.INSTANCE.configureEngineIndexes(
    Arrays.asList(VehicleEngineIndex.GASOLINE, VehicleEngineIndex.DIESEL, ...)
);
```

{% endtab %}
{% endtabs %}

**Settings:**&#x20;

* `GASOLINE`
* `DIESEL`
* `ELECTRIC`
* `GASOLINE_HYBRID`
* `PLUG_IN_GASOLINE_HYBRID`
* `DIESEL_HYBRID`

**Default values:** \[`GASOLINE`, `DIESEL`, `ELECTRIC`, `GASOLINE_HYBRID`, `PLUG_IN_GASOLINE_HYBRID`, `DIESEL_HYBRID`]
