Get started

Prerequisite

Before starting DriveKit Vehicle UI integration, make sure that you have initialized Vehicle and Common UI components.

Integration

To add Vehicle module to your app, add the following line to your dependencies in your application build.gradle file:
1
dependencies {
2
implementation 'com.drivequant.drivekit:drivekit-vehicle-ui:$drivekitui_version'
3
}
Copied!
Replace $drivekitui_version with the DriveKit version you are using in your app
On a Github repository, you can find a demo app and the source code of Vehicle UI that you can use as an example.

Initialization

You must initialize the UI module with that following method:
Kotlin
Java
1
DriveKitVehicleUI.initialize()
Copied!
1
DriveKitVehicleUI.INSTANCE.initialize();
Copied!
This method will configure the module with default values for the parameters: VehicleTypes, maxVehicles, categoryConfigType, detectionModes.
For each of these parameters, you will find below their related descriptions.

Display vehicle list

To display the vehicle list to the driver, just call the following method:
Kotlin
Java
1
DriveKitNavigationController.vehicleUIEntryPoint?.startVehicleListActivity(context)
Copied!
1
final VehicleUIEntryPoint vehiclesEntryPoint = DriveKitNavigationController.INSTANCE.getVehicleUIEntryPoint();
2
if (vehiclesEntryPoint != null) {
3
vehiclesEntryPoint.startVehicleListActivity(getContext());
4
}
Copied!

Display vehicle detail

To display the vehicle detail, just call the following method:
Kotlin
Java
1
DriveKitNavigationController.vehicleUIEntryPoint?.startVehicleDetailActivity(context, vehicleId)
Copied!
1
final VehicleUIEntryPoint vehiclesEntryPoint = DriveKitNavigationController.INSTANCE.getVehicleUIEntryPoint();
2
if (vehiclesEntryPoint != null) {
3
vehiclesEntryPoint.startVehicleDetailActivity(getContext(), vehicleId);
4
}
Copied!

Display vehicle picker

To display vehicle selection screens, just call the following method:
Kotlin
Java
1
VehiclePickerActivity.launchActivity(
2
context: Context,
3
vehicleToDelete: Vehicle? = null,
4
listener : VehiclePickerCompleteListener? = null)
Copied!
1
VehiclePickerActivity.Companion.launchActivity(context: Context);
Copied!
  • VehiclePickerCompleteListener : This callback is called when VehiclePickerActivity has finished
  • vehicleToDelete : If you want to replace your vehicle, you can use this parameter, it will delete and create a new one.