Android

Integration

To add the Trip Simulator module to your app, add the following line to your dependencies in your application build.gradle file:

dependencies {
    debugImplementation 'com.drivequant.drivekit:drivekit-trip-simulator:$drivekit_version'
}

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 component will receive the configured callbacks automatically.

NameDuration (min)Distance (km)Description

SHORT_TRIP

8

2

Trip too short that does not allow to rate the driver's behavior

MIXED_TRIP

15

12

A mixed trip in urban and suburban areas

CITY_TRIP

20

8

A city trip

SUBURBAN_TRIP

30

30

A trip performed in a suburban environment mostly

HIGHWAY_TRIP

55

100

A highway trip

TRAIN_TRIP

10

5

Trip recorded in a train to test the alternative transportation modes detection

BUS_TRIP

13

3

Trip recorded in a bus to test the alternative transportation modes detection

BOAT_TRIP

40

25

Trip recorded in a boat to test the alternative transportation modes detection

TRIP_WITH_CRASH_1

5

1

A trip to simulate an unconfirmed or a confirmed crash.

TRIP_WITH_CRASH_2_STILL_DRIVING

23

24

A trip to simulate an accident confirmed less than two minutes after the start of the trip, after which the driver continued driving.

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 following method with a appropriate configuration with the PresetTrip parameter.

fun start(presetTrip: PresetTrip, listener: DKTripSimulatorListener? = null): Boolean

Stop the simulation

To stop the trip simulation, you must call the following method:

fun stop()

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 an accident to check your integration, you must choose between TRIP_WITH_CRASH_1 or TRIP_WITH_CRASH_2_STILL_DRIVING as PresetTrip parameter:

Possible values for PresetTripCrash1 enum used by TRIP_WITH_CRASH_1 are described in the table below:

NameDescription

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.

DriveKitTripSimulator.start(PresetTrip.TRIP_WITH_CRASH_1(PresetTripCrash1.CONFIRMED_30KMH.CONFIRMED_30KMH))

Last updated