Android

Integration

To add the Trip Simulator module to your app, add the following line to your dependencies in your application build.gradle file:
1
dependencies {
2
debugImplementation 'com.drivequant.drivekit:drivekit-trip-simulator:$drivekit_version'
3
}
Copied!
Replace $drivekit_version with the DriveKit version you are using in your app
This component has been designed to facilitate preliminary testing and should never remain in your production app. In order to avoid building the Trip Simulator module in release mode, it is recommended to build it with debugImplementation.

Usage

DriveQuant offers the possibility of running simulations from a list of preset trips. After integrating and activating the trip simulation component, you can select a preset trip from those described in the table below. Once the simulation is launched, the Trip Analysis SDK will receive the configured callbacks automatically.
Name
Duration
Distance
Description
SHORT_TRIP
8 min
2 km
Trip too short that does not allow to rate the driver's behavior
MIXED_TRIP
15 min
12 km
A 15-minute mixed trip in urban and suburban areas
CITY_TRIP
20 min
8 km
A 20-minute city trip
SUBURBAN_TRIP
30 min
30 km
A 30-minute trip performed in a suburban environment mostly
HIGHWAY_TRIP
55 min
100 km
A 55-minute highway trip
TRAIN_TRIP
10 min
5 km
Trip recorded in a train to test the alternative transportation modes detection
BOAT_TRIP
40 min
25 km
Trip recorded in a boat to test the alternative transportation modes detection
TRIP_WITH_CRASH
5 min
1 km
A trip dedicated to simulate a crash.

Enable Developer Mode

The user must enable the developer mode in Android. The official documentation explains well how to proceed.

Mock Location App

In the Debugging category, tap on Select mock location app and select yours. It sometimes appears that you might uninstall and reinstall your app on the device in order to register it as a mock location app.

Simulate a trip

To simulate a trip, call the start method in TripSimulator with a appropriate configuration with the PresetTrip parameter.
Kotlin
Java
1
DriveKitTripSimulator.start(PresetTrip.MIXED_TRIP)
Copied!
1
DriveKitTripSimulator.INSTANCE.start(PresetTrip.MIXED_TRIP);
Copied!

Stop the simulation

To stop the trip simulation, you must call the stop method in TripSimulator:
Kotlin
Java
1
DriveKitTripSimulator.stop()
Copied!
1
DriveKitTripSimulator.INSTANCE.stop();
Copied!
Otherwise you can manually remove your app as the mock location app in the developers settings.

Simulate a crash during a trip

In order to mock a crash to check your integration, you must choose the TRIP_WITH_CRASH PresetTrip item, with a CrashType object as parameter. Possible values for PresetCrashConfiguration enumeration are described in the table below:
Name
Description
CONFIRMED_30KMH
A short trip with a collision at 30 km/h that occurs 137 seconds after the trip begins and that corresponds to a confirmed accident.
CONFIRMED_20KMH
A short trip with a collision at 20 km/h that occurs 141 seconds after the trip begins and that corresponds to a confirmed accident.
CONFIRMED_10KMH
A short trip with a collision at 10 km/h that occurs 146 seconds after the trip begins and that corresponds to a confirmed accident.
UNCONFIRMED_0KMH
A short trip with a collision during a vehicle stop that occurs 159 seconds after the trip begins and that corresponds to an unconfirmed accident.
Kotlin
Java
1
DriveKitTripSimulator.start(PresetTrip.TRIP_WITH_CRASH(CrashType.CONFIRMED_30KMH))
Copied!
1
DriveKitTripSimulator.INSTANCE.start(new PresetTrip.TRIP_WITH_CRASH(CrashType.CONFIRMED_30KMH));
Copied!