Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Before you start, we recommend that you install the DriveKit Demo App and perform some testing to get familiar with the SDK's behavior and features.
The DriveKit Demo App integrates all components of the DriveKit SDK and you can refer to the code before installing the Trip Analysis component in your mobile application.
You can find all resources on Github.
In order to understand how the smartphone telematics SDK works and how it will transform your app into a powerful sensor, take the time to read the following section that explains briefly the expected behavior.
The DriveKit SDK (TRIP ANALYSIS component) has the ability to automatically detect and record a trip when your application runs in background.
Before integrating the Trip Analysis component into your application, it is recommended that you understand how it works. This section explains the main states of the SDK during a trip as well as the events that trigger the transitions between states.
The diagram below shows, from top to bottom:
Events that trigger the transition from one state to another,
Main SDK states,
Accessible callbacks that your application can use to implement your own business logic.
Here is a brief description of the sequence of trip analysis from A to Z. Beneath the braces, the list contains all the methods that can be called at each stage of a trip's recording.
Trip Detection: the SDK does not start instantly at the beginning of the trip. There is a variable delay during which the application identifies that a trip might be in progress. If the probability is high enough, the application turns on the GPS sensor and starts to analyze the vehicle's speed.
Trip confirmation: the trip is not validated immediately. Beforehand, the SDK checks if the trip speed is consistent with that of a motor vehicle. If this is not the case, the trip will be canceled naturally and no data will be stored locally (and no data will be transmitted to the DriveQuant's server).
Trip Recording: if the trip is confirmed by the SDK, then the data are recorded locally for the entire trip.
End of Trip Detection: the SDK can determine if the trip is completed. Each time the vehicle stops, a timer starts to check whether the stop is definitive or not. Depending on your needs, it is possible to set a time delay for stopping a trip. The default timeout value is 4 minutes. You can adjust this value between 2 and 8 minutes.
Trip Analysis: once the trip has been completed, the SDKs automate the request to the trip analysis API. If the smartphone is not connected to a mobile network, the request will be retried later.
The use of the DriveQuant SDK has a minimal impact on the driver's smartphone data plan. Data consumption is a topic that users of your application may be concerned about, so we have done our best to limit the amount of data used by the SDK.
The trip data are recorded with a frequency of 1Hz and are transmitted in text format. The volume of data recorded is about 5 kb per minute of driving:
50 kb of data are used for the analysis of a short 10-minute trip,
150 kb of data are used for the analysis of a 30-minute trip,
A 2-hour long trip uses 600 kb of data.
The average data usage for a commuter working 30 minutes from home will be in the range of 10 Mb to 12 Mb per month.
The DriveKit SDK measures data from smartphone sensors while minimizing the impact on the battery. It automatically detects the start and end of a motorized trip and does not use the GPS sensor outside of the trip.
This helps to avoid draining the phone's battery and protects the user's privacy. Location data from the phone are not collected outside of the phases where the user is driving.
DriveKitDelegate
is a protocol that can be passed as a parameter during the DriveKit Core module initialization. It gives useful events about the user lifecycle.
driveKitDidConnect(_ driveKit: DriveKit)
The user has been successfully logged
driveKitDidDisconnect(_ driveKit: DriveKit)
The user has been disconnected (manual logout or the account is disabled/deleted)
driveKit(_ driveKit: DriveKit, didReceiveAuthenticationError error: RequestError)
The login has failed due to a RequestError
userIdUpdateStatusChanged(status: UpdateUserIdStatus, userId: String?)
The update userId request has been processed with a UpdateUserIdStatus
state value
onAccountDeleted(status: DeleteAccountStatus)
The delete account request has been processed with a DeleteAccountStatus
state value.
UpdateUserIdStatus
is an enum that explains the request status after a userId has asked to be changed.
updated
The userId has been successfully updated
failedToUpdate
Occurs when DriveKit is not configured yet or if the new userId is the same as the old one
invalidUserId
Error returned when the new userId is blank
alreadyUsed
The new userId is already taken by another user
savedForRepost
The request failed but a retry will be done
RequestError
is an enum that describes the error type of a DriveKit request.
noNetwork
The user has no connection or a bad one during the request.
unauthenticated
A request has been launched but the user is not logged (401 error).
forbidden
A 403 error occurred. You might don't have access to call that service. Please contact the DriveQuant to learn more.
serverError
Drivequant's backend responds with a 500 server error.
clientError
Drivequant's backend responds with a 400 error different than unauthenticated
, forbidden
and limitReached
unknownError
An unknown error occurred, please contact the Drivequant team to investigate the issue.
limitReached
The DriveKit API key has reached the accounts number limit. Please contact the Drivequant team.
DeleteAccountStatus
is an enum that describes the deletion status. It can have 3 values:
success
: Account deleted successfully
failedToDelete
: Account not deleted, an error has occurred
forbidden
: Account deletion not activated for this team
DKWeather
is an enum that describe each category of weather during a trip. It can have these values:
unknown
sun
cloud
fog
rain
snow
ice
In this part, we will take you through the required basic steps to detect your first trips using DriveKit.
To complete this quickstart, make sure that your development environment meets the following requirements:
Xcode (latest version)
An iPhone device, running on iOS 13.0+
A DriveKit API key. If you don't have an API key, please contact us.
Follow the steps described below in your app in order to quickly integrate the DriveKit SDK:
The DriveKit SDK is available on CocoaPods public repository.
To add TripAnalysis module, add the following line to your Podfile:
then run pod install
By adding the TripAnalysis module, it will also add the DriveKit Core module and automatically initialize the DriveKit SDK.
In some cases you may want to manually initialize the SDK. To do this you have to disable the automatic initialization. Learn more in the Advanced configurations part.
Go to the Capabilities tab of your target settings.
Turn on Background Modes
Enable Location updates (to be able to receive location updates in the background)
Enable Background fetch (to periodically check for changes related to the status of authorizations, sensors, as well as user disconnection. See more info here)
As DriveKit requires a user's location and motion data, it is required to get permissions from the user.
When the application requests permission for background locations or motion activities, usage description messages will be shown to the user.
Since DriveKit imports CoreBluetooth framework, we strongly recommend you to also include Bluetooth usage description message.
You must configure these messages by adding the following lines in the Info.plist
file:
These values can be localized (see our English file for example).
DriveKit periodically checks for changes related to the status of authorizations, sensors as well as user disconnection. This information is included in the diagnostic log file and shared with the DriveQuant platform.
To be more accurate, this feature needs to have background fetch capability and a background task id declared in your Info.plist
file.
You must add the following line in Info.plist
file:
Once you've stored your API key in a secure way in your app, configure DriveKit by calling the following method:
Each driver must be identified with a unique identifier. Once you have this identifier and you are ready to analyze trips, configure DriveKit by calling the following method:
You can call setApiKey
and setUserId
methods anywhere in the code. DriveKit will save the value locally. If the app is killed and relaunched, DriveKit will be reconfigured automatically.
We recommend never using an email address or phone number to define the unique user ID. It is recommended that you set up a unique, universal and anonymous user ID. For example, you can generate a globally unique identifier (GUID) for each of your users.
DriveKit SDK will not work until you set the API key and the userId.
The automatic mode detects vehicle movements and triggers the trip analysis without driver intervention while the application is in background. The analysis is stopped automatically at the end of the trip.
This feature is recommended to avoid driver distraction and phone handling while driving. The automatic mode has been optimised to limit the battery drain.
By default, automatic trip detection is disabled, but you can enable it by calling the following method with the enable
parameter to true
:
To display a simple and intuitive onboarding for the user to grant these runtime permissions, add the dependency for the PermissionUtils graphical module in your Podfile:
then run pod install
The method below helps you to configure the required permission requests and the order in which they are displayed. You will be notified when the requested permissions are successfully granted:
Congratulations! You now have an app that will automatically detect every trip you will make.
Once your first trips are recorded, fine-tune the DriveKit SDK configuration to fit your needs:
Configure the Core and TripAnalysis modules with advanced settings. For example, alert the user once a trip has been analyzed by the DriveQuant servers by displaying a notification, activate the crash detection, etc.
Display trip-related data: provide a trip list, a timeline of driver’s score, present the user's driving habits, etc. by integrating the Driver Data module.
Associate each trip to a vehicle that you can configure with the Vehicle module.
Improve user retention by organizing challenges, display ranking with the community, show which badges the driver earned, etc.
A quick overview of DriveKit to understand the main features and principles.
This documentation is for developers. Follow the simple guideline to install our telematics SDK and access powerful insight and actionable data.
DriveKit is a modularized software suite for creating mobile applications to engage and coach drivers.
DriveKit is composed of SDK available on both iOS and Android platforms and web services (REST API) that are designed to collect, analyze, organize, store and display driving data.
DriveKit is a 100% mobile telematics technology based on smartphone sensors to analyze vehicle trips and evaluate the influence of driving style on safety and energy consumption.
In addition to data analysis, DriveKit allows you to easily and quickly integrate features into your application to help drivers improve and manage their vehicles on a daily basis: coaching, ludic functions, mileage monitoring, car maintenance. All these features can be tested in our demo application (on iOS and Android).
The DriveKit SDK transforms any iOS or Android application into a data collection solution to measure and improve driving behavior.
The SDK provides automatic detection of vehicle trips and recording of GPS data locally during the trip.
At the end of a trip, the SDK automatically requests the data analysis services embedded on the DriveQuant platform.
The DriveQuant platform contains the signal processing algorithms and databases where raw data and driving indicators resulting from the analyzes are stored.
The results of a trip analysis are usually returned to the application within seconds after the end of the trip.
The SDK contains a local database that is automatically and continuously synchronized with the DriveQuant platform database.
The DriveKit SDK is a set of independent features integrated into modules.
Some of these modules include graphical libraries with user interfaces.
The table below summarizes all the modules included in DriveKit:
Core
SDK management: authentication, user creation, diagnostic functions (logs, permissions and sensors status).
❌
Recording of sensor signals and automatic trip detection.
✅
Synchronisation of all user data in the local SDK database.
✅
Configuration of one or more vehicles linked to a user's account.
✅
Graphical interfaces that help to collect the user permissions to run the SDK.
✅
Management of driving challenges.
✅
User engagement features: ranking, badge and streaks
✅
Not all the DriveKit SDK modules listed in this table are strictly necessary. The key modules for transforming your application into a telematics solution are: Core and Trip Analysis.
If you plan to display the driving analysis results in your mobile application, we strongly recommend that you install the Driver Data module, which synchronizes all a driver's trips, synthesis and historical data.
100% mobile and high-performance telematics solution.
Easy and quick integration.
Automatic trip recording.
Optimized battery consumption.
Minimal use of data.
Built-in database with automatic synchronization.
A wide range of analytics and services.
Plug-and-play user interfaces.
To better understand how the DriveKit SDK is working, we recommend you to test the DriveKit Demo app. It contains all the DriveKit SDK components and has been developed to guide mobile developers to understand how DriveQuant's telematics solution works. The DriveKit Demo App is available on GitHub for iOS and Android.
You can contact DriveQuant via email at contact@drivequant.com to request a demonstration, to be supported during the integration phase or to get answers to any specific requests.
By default, the DriveKit SDK is automatically initialized as soon as you add the TripAnalysis module to your project.
In some cases, you may want to manually initialize the SDK. To do this, you have to disable the automatic initialization by adding the key DKAutoInitEnabled
associated to the Boolean value false
into the Info.plist
file:
Then, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate
.
The DriveKit modules include a method initialize
that must be called in didFinishLaunchingWithOptions
method of your AppDelegate
if you have decided to manually initialize the SDK.
You can check if DriveKit is well configured with the following method:
This method returns true
if these three conditions are met:
DriveKit Core is initialized
an API key is set
a userId is set
You can check if the user is connected by calling the following method:
This method returns true
if the user is authenticated to DriveKit.
DriveKit comes with a logging feature that is enabled by default. This feature allows you to quickly identify the cause of a problem. We recommend leaving the log enabled as it does not consume memory space and is useful in the support phase. However, if you don't want to use it, it can be disabled.
Disable logging by calling the following method:
To activate logging, call the following method:
If the user disables the sensors or revokes permissions, the application would not be able to detect and record a trip. To avoid this, the SDK identifies important sensor state and permission changes.
These events are shared and you can use them in your application to inform the user via a visual alert or by displaying a notification.
DKDeviceConfigurationDelegate
is a protocol used to get callbacks when device configuration changes are detected:
To add a delegate and listen for Device Configuration Events, you can call the following function:
To remove a specific delegate, call the following method:
To remove all delegates, call the following method:
DKDeviceConfigurationEvent
is a class describing a device configuration event.
type
Enum
isValid
Boolean
Boolean describing whether the device configuration event is valid or not
Possible types are:
activityPermission
Motion & Fitness permission status changed
locationPermission
Location permission status changed
bluetoothPermission
Bluetooth permission status changed
notificationPermission
Notifications permission status changed
lowPowerMode
Low Power Mode status changed
locationSensor
Location sensor status changed
bluetoothSensor
Bluetooth sensor status changed
The DriveKit SDK will run optimally if the isValid value of each event is true. The table below explains the impact of a status that is not true.
LocationPermission
🔴
No trip recording if app has no access to GPS sensor
BluetoothPermission
🟡
No trip detection based on Bluetooth system
ActivityPermission
🟡
Detected transportation mode mode can be inaccurate when no access to this permission
NotificationPermission
🟢
Your application cannot send notification to the user if the permission is revoked.
lowPowerMode
🟢
No considerable impact
LocationSensor
🔴
No trip recording if GPS sensor is disabled
BluetoothSensor
🟡
No trip detection based on Bluetooth system. Can also impact beacon trip detection.
To get user’s information (first name, last name and pseudo), call the getUserInfo
method. It will retrieve and save these data locally:
You can add information to a user's account such as first name, last name and pseudo. These details are optional and you can choose to make the user's account anonymous. To update the user's information, you must call the updateUserInfo
method:
Or to update all information:
It is possible to update the userId by calling the following method:
You can delete a driver's account in DriveKit. This action deletes all the data related to the account.
The deletion can be done instantly or with delay.
In the first case, when the method is called, the account is instantly deleted.
In the second case, the driver has 30 days to log back into the application and reactivate his account.
To delete a driver's account, use the following method:
instantDeletion
can have 2 values:
false
: Default value, allows the user to recover the deleted account by logging-in again with the same credentials. Users have 30 days starting from the day when the account was deleted.
true
: Allow to delete an account instantly. The account and all the related data will be immediately deleted and no rollback is possible.
You should restore the DriveKit API key in the onAccountDeleted()
callback only when the status value is SUCCESS
.
If you need to reset DriveKit configuration (user logout for example), you can call the following method:
All data saved locally will be erased and default configuration for every module will be restored.
The DriveKit guides explain step by step how to install and use DriveKit. It's available on iOS and Android or via a REST API.
It is necessary to read this documentation before modifying any code in your project.
You must consider the two main categories of behaviours changes related to Android 14:
To make your app fully compatible with Android 14, update the targetSdkVersion
and compileSdkVersion
to 34
in your project app.
It's now time to update your code once the previous steps are taken into account.
DriveQuant recommends to specifically pay attention about these topics that can lead to a runtime crash:
After you have checked that your project is working properly and updated the targetSdkVersion
and compileSdkVersion
, you need to update the DriveKit SDK.
DriveKit internal modules that support Android 14 are versions 1.35 and above.
DriveKit UI modules that support Android 14 are versions 1.39 and above.
If you experience any problems with DriveKit, please contact us.
In this part, we will take you through the required basic steps to detect your first trips using DriveKit.
To complete this quickstart, make sure that your development environment meets the following requirements:
Android Studio (latest version)
An Android 8.0+ device with Play Services
Your Android app must target API level 26 or higher.
Follow the steps described below in your app in order to quickly integrate the DriveKit SDK:
The DriveKit SDK is available on the DriveQuant Maven repository.
To access modules in the repository, add the following lines in your Gradle settings appropriate file, according to the structure of your app:
To add the Trip Analysis module to your app, add the following line to your dependencies in your appropriate application build Gradle file:
By adding the TripAnalysis module, it will also add the DriveKit Core module and automatically initialize the DriveKit SDK.
DriveKit periodically checks for changes related to the status of permissions, sensors, as well as user disconnection. This information is included in the diagnosis log file and shared with the DriveQuant platform.
To be more accurate and capture application uninstall events, you need to allow your app to backup data.
To do this, set the allowBackup
attribute to true
in your Manifest project app file as shown in the following example:
Once you've stored your API key in a secure way in your app, configure DriveKit by calling the following method:
Each driver must be identified with a unique identifier. Once you have this identifier and you are ready to analyze trips, configure DriveKit by calling the following method:
You can call setApiKey()
and setUserId()
methods anywhere in the code. DriveKit will save the value locally. If the app is killed and relaunched, DriveKit will be reconfigured automatically.
DriveKit SDK will not work until you set the API key and the userId.
The automatic mode detects vehicle movements and triggers the trip analysis without driver intervention even if the application is in background. The analysis is stopped automatically at the end of the trip.
This feature is recommended to avoid driver distraction and phone handling while driving. The automatic mode has been optimized to limit the battery drain.
By default, automatic trip detection is disabled, but you can enable it by calling the following method with the activate
parameter to true
:
DriveKit requires some runtime permissions to be granted by the user.
To display a simple and intuitive onboarding for the user to grant these runtime permissions, add the dependency for the PermissionsUtils graphical module in your appropriate application build Gradle file:
Then, call the following code in your project:
Congratulations! You now have an app that will automatically detects every trip you will make.
Once your first trips are recorded, fine-tune the DriveKit SDK configuration to fit your needs:
UpdateUserIdStatus
is an enum that explains the request status after a userId has asked to be changed.
RequestError
is an enum that describes the error type of a DriveKit request.
DeleteAccountStatus
is an enum that describes the deletion status. It can have 3 values:
SUCCESS
: Account deleted successfully
FAILED_TO_DELETE
: Account not deleted, an error has occurred
FORBIDDEN
: Account deletion not activated for this team
DKWeather
is an enum that describe each category of weather during a trip. It can have these values:
UNKNOWN
SUN
CLOUD
FOG
RAIN
SNOW
ICE
It is necessary to read this documentation before modifying any code in your project.
You must consider the two main categories of behaviours changes related to Android 15:
To make your app fully compatible with Android 15, update the targetSdkVersion
and compileSdkVersion
to 35
in your project app.
It's now time to update your code once the previous steps are taken into account.
After you have checked that your project is working properly and updated the targetSdkVersion
and compileSdkVersion
, you need to update the DriveKit SDK.
DriveKit internal modules that support Android 15 are versions 2.4.0
and above.
DriveKit UI modules that support Android 15 are versions 2.4.0
and above.
By default, the DriveKit SDK is automatically initialized as soon as you add the TripAnalysis module to your project.
In some cases, you may want to manually initialize the SDK. To do this you have to disable the automatic initialization by adding the following lines into your Manifest file:
Then, you must call the initialization methods in the onCreate
method of your Application class:
You can check if DriveKit is well configured with the following method:
This method returns true
if these three conditions are met:
DriveKit Core is initialized
an API key is set
a userId is set
You can check if the user is connected by calling the following method:
This method returns true
if the user is authenticated to DriveKit.
DriveKit comes with a logging feature that is enabled by default. This feature allows you to quickly identify the cause of a problem. We recommend leaving the log enabled as it does not consume memory space and is useful in the support phase. However, if you don't want to use it, it can be disabled.
You can retrieve the Uri
log file by calling the following method on DriveKitLog
class:
Disable logging by calling the following method on DriveKit
class:
To enable logging, call the following method on DriveKit
class, specifying (if needed) the path of the log directory:
If the user disables the sensors or revokes permissions, the application would not be able to detect and record a trip. To avoid this, the SDK identifies important sensor state and permission changes.
These events are shared when the user is logged in and you can use them in your application to inform the user via a visual alert or by displaying a notification.
DKDeviceConfigurationListener
is the interface used to get callbacks when device configuration changes are detected:
To remove a specific listener, call the following method:
To remove all listeners, call the following method:
DKDeviceConfigurationEvent
is a sealed class that describes a device configuration change event:
Possible events are:
The DriveKit SDK will run optimally if the isValid
value of each event is true
. The table below explains the impact of a status that is not true
:
To get the user's information (first name, last name and pseudo), call the getUserInfo
method. This method will retrieve and save these data locally:
You can add information to a user's account such as first name, last name and pseudo.
These details are optional and you can choose to make the user's account anonymous. To update the user's information, call the following method :
It is possible to update the userId by calling the following method:
You can delete a driver's account in DriveKit. This action deletes all the data related to the account.
The deletion can be done instantly or with delay.
In the first case, when the method is called, the account is instantly deleted.
In the second case, the driver has 30 days to log back into the application and reactivate his account.
To delete a driver's account, use the following method:
instantDeletion
can have 2 values:
false
: Default value, allows the user to recover the deleted account by logging-in again with the same credentials. Users have 30 days starting from the day when the account was deleted.
true
: Allow to delete an account instantly. The account and all the related data will be immediately deleted and no rollback is possible.
You should restore the DriveKit API key in the onAccountDeleted()
callback only when the status value is SUCCESS
.
If you need to reset DriveKit configuration (user logout for example), you can call the following method:
All data saved locally will be erased and default configuration for every module will be restored.
enum describing the type of event
Android offers a clear and exhaustive listing the new features and changes related to Android 14.
The last part is to ensure that the app is working as expected. The best way to do this is to compare your app's behaviour with the and/or the ; which already support Android 14.
You can also clone the following , configure the required credentials then simply run the quickstart app!
Replace $drivekit_version
with the latest release version of DriveKit on the page.
In some cases you may want to manually initialize the SDK. To do this you have to disable the automatic initialization. Learn more in the part.
By enabling backup, only DriveKit data will be backed up. If you want to back up data of your application (such as your SharedPreferences), you must declare your own rules in your Manifest (see ).
All other diagnosis events (described ) will be provided regardless of the allowBackup
configuration.
In case of Manifest merging issue with DriveKit, please refer to the page.
We recommend never using an email address or phone number to define the unique user ID. It is recommended that you set up a unique, universal and anonymous user ID. For example, you can generate a globally unique identifier () for each of your users.
Replace $drivekitui_version with the latest release version of graphical modules on the page.
Configure the and modules with advanced settings. For example, ,, activate the , etc.
Display trip-related data: provide a trip list, a timeline of driver’s score, present the user's driving habits, etc. by integrating the module.
Associate each trip to a vehicle that you can configure with the module.
Improve user retention by organizing , display with the community, show which the driver earned, etc.
The DriveKit SDK version is configured with these attributes:
DriveKit uses . If you use , you need to add android:fullBackupOnly
in your .
DriveKitListener is an interface that can be passed as a parameter during the DriveKit Core module . It gives useful events about the user lifecycle.
Android offers a clear and exhaustive listing the new features and changes related to Android 15.
DriveQuant recommends to specifically pay attention about the which is now enabled by default when your app is targeting Android 15.
If your app is not ready to support edge-to-edge, you can disable it by using the attribute.
The last part is to ensure that the app is working as expected. The best way to do this is to compare your app's behaviour with the and/or the ; which already support Android 15.
If you experience any problems with DriveKit, please contact .
To add a listener and get informed for , you can call the following method:
To be able to check whenever userId
got updated and catch the update status you have to use listener.
To be able to check whenever the account deletion is complete, you have to use the interface.
minSdkVersion
26 (Android 8)
compileSdkVersion
35 (Android 15)
targetSdkVersion
35 (Android 15)
Kotlin
1.8.22
Java
17
Gson
2.10.1
Volley
1.2.1
Room
2.5.2
Work Manager
2.9.0
Play Services Location
21.0.1
onConnected()
The user has been successfully logged
onDisconnected()
The user has been disconnected (manual logout or the account is disabled/deleted)
onAuthenticationError(errorType: RequestError)
The login has failed due to a RequestError
userIdUpdateStatus(status: UpdateUserIdStatus, userId:String?)
The update userId request has been processed with a UpdateUserIdStatus
state value
onAccountDeleted(status: DeleteAccountStatus)
The delete account request has been processed with a DeleteAccountStatus
state value
UPDATED
The userId has been successfully updated
FAILED_TO_UPDATE
Occurs when DriveKit is not configured yet or if the new userId is the same as the old one
INVALID_USER_ID
Error returned when the new userId is blank
ALREADY_USED
The new userId is already taken by another user
SAVED_FOR_REPOST
The request failed but a retry will be done
NO_NETWORK
The user has no or a bad connection during the request.
UNAUTHENTICATED
A request has been launched but the user is not logged (401 error).
FORBIDDEN
A 403 error occurred. You might don't have access to call that service. Please contact the DriveQuant to learn more.
SERVER_ERROR
Drivequant's backend responds with a 500 server error.
CLIENT_ERROR
Drivequant's backend responds with a 400 error different than UNAUTHENTICATED
, FORBIDDEN
and LIMIT_REACHED
UNKNOWN_ERROR
An unknown error occurred, please contact the Drivequant team to investigate the issue.
LIMIT_REACHED
The DriveKit API key has reached the accounts number limit. Please contact the Drivequant team.
LocationPermission
Location permission status changed
ActivityPermission
Activity Recognition permission status changed
NearbyDevicesPermission
Nearby Devices permission status changed
NotificationPermission
Notification permission status changed
AutoResetPermission
Auto-reset permission status changed
AppBatteryOptimization
Battery Optimization app status changed
LocationSensor
Location sensor status changed
BluetoothSensor
Bluetooth sensor status changed
LocationPermission
🔴
No trip recording if app has no access to GPS sensor
ActivityPermission
🟡
Poor trip detection
NearbyDevicesPermission
🟡
No trip detection based on beacon or Bluetooth system
NotificationPermission
🟢
Your application cannot send notification to the user if the permission is revoked.
AutoResetPermission
🟢
Revocation of all permissions if app is not opened for 3 months.
AppBatteryOptimization
🟡
Poor trip detection, application may be killed in background
LocationSensor
🔴
No trip recording if location sensor is disabled
BluetoothSensor
🟡
No trip detection based on beacon or Bluetooth system
The trip analysis API transforms GPS data collected by a smartphone or any other telematics system into actionable driver and vehicle analytics.
This API is automatically queried by the mobile SDKs as soon as a trip is completed. The results are returned, after a few seconds, to the SDK and can also be transmitted via a push data service to a third-party server.
The API provides a broad range of indicators that depends on your subscription. DriveKit's trip analysis API provides more than 200 indicators per trip. They are organized by categories so that you can choose the ones that best suit your use case. The categories of driving indicators are listed below.
Data that represent the driver's behavior:
Eco-driving score.
Safety score.
Distraction score (phone use).
Speed limits score.
Data that measure the impact of driving behavior on the vehicle:
Fuel consumption.
Pollutant emissions.
Tires and brakes wear.
Additional data describing the context of the trip:
Departure and arrival adresses and dates.
Average speed.
Driving context.
Weather.
The Trip analysis component also contains an accident detection feature that uses the smartphone's sensors to automatically detect if the vehicle has been involved in a crash. Smartphone-based accident detection allows you to:
offer a driver assistance solution integrated into your application;
access accurate data to speed up claims management.
This page can be helpful if you encounter some build issues with DriveKit SDK in your app.
dataExtractionRules
property merge issueIf an error message appeared when building your app is something like:
Error: Attribute application@dataExtractionRules value=(@xml/data_extraction_rules) from AndroidManifest.xml:12:9-65 is also present at [com.drivequant.drivekit:drivekit-core:x.x.x] AndroidManifest.xml:13:9-56 value=(@xml/backup_rules). Suggestion: add 'tools:replace="android:dataExtractionRules"' to element at AndroidManifest.xml:9:5-31:19 to override.
It's a backup rules merging issue with DriveKit SDK rules and your app and/or another external library you use.
To resolve this, update your AndroidManifest.xml
file:
Then find the related backup rules of your app or the external library and create the file merged_data_extraction_rules.xml
in the src/main/res/xml
folder:
fullBackupContent
property merge issueIf an error message appeared when building your app is something like:
Error: Attribute application@fullBackupContent value=(@xml/app_backup_exclusion) from [com.anotherSdk.library:xxx:x.y.z] AndroidManifest.xml:22:18-76 is also present at [com.drivequant.drivekit:drivekit-core:x.x.x] AndroidManifest.xml:11:9-69 value=(@xml/backup_rules_pre_android_12). Suggestion: add 'tools:replace="android:fullBackupContent"' to element at AndroidManifest.xml:42:3-72:17 to override.
It's a backup rules merging issue with DriveKit SDK rules and your app and/or another external library you use.
To resolve this, update your AndroidManifest.xml
file:
Then find the related backup rules of your app or the external library and create the file merged_backup_rules.xml
in the src/main/res/xml
folder:
If you have both dataExtractionRules and fullBackupContent merge issues, you have to declare the two attrbutes as follows:
BackupAgent
merge issueIf an error message appeared when building your app looks like:
It's because DriveKit SDK is using the BackupAgent
to restore some user information when the user has reinstalled the app.
DriveKit is providing two ways to handle the error:
DriveKitBackupAgent
The easiest way is to make your BackupAgent
class inherits our DriveKitBackupAgent
class.
If you cannot inherit from DriveKitBackupAgent
class, e.g. when you already inherits from another class, you can still:
Add tools:replace="android:backupAgent
in your Manifest as suggested in the error message.
Call DriveKitBackupAgent.onCreate(BackupAgentHelper)
in your overriden onCreate()
method
Call DriveKitBackupAgent.onRestoreFinished(BackupAgentHelper)
in your overriden onRestoreFinished()
method
If your use case requires it, it is possible to add your own data in the trip analysis request. For example, it can be data that is specific to your trip, application or user identification system.
Metadata is persisted, so if you want to send it only for one trip, you need to remove it at the end of the trip, on the sdkStateChanged(state: State)
callback, by checking if state
is inactive
.
You can add additional metadata to your trip by calling the following method:
The metadata must be represented as a key/value object where the key and value have a String type.
The metadata can be set any time before the end of a trip.
If metadata is sent, it will also be added to the push data request in the metaData field.
It is possible to get a copy of configured metadata thanks to the following method on DriveKitTripAnalysis:
To update a value in metadata, call the following method:
To delete a specific value in metadata, call the following method:
To delete all values in metadata, call this method:
The TripListener
protocol provides useful information and events about trips analyzed by DriveKit.
For example, you can be informed when a trip analysis has started, finished, canceled, when a crash is detected, etc.
You can remove a specific listener using the following method:
To remove all TripListeners objects:
Do not forget to remove your TripListener
objects when you don't need it anymore.
TripListener
interface includes several methods to implement:
tripRecordingStarted(state: DKTripRecordingStartedState)
Immediately called when a trip recording starts.
This callback is triggered:
after automatic trip detection.
tripRecordingConfirmed(state: DKTripRecordingConfirmedState)
tripRecordingCanceled(state: DKTripRecordingCanceledState)
Called when a trip recording is canceled. DKTripRecordingCanceledState
indicates which event has canceled the trip.
tripRecordingFinished(state: DKTripRecordingFinishedState)
tripFinished(responseStatus: TripResponseStatus)
This method is called when a trip has been recorded by the SDK and analyzed by the DriveQuant's servers.
tripPoint(tripPoint: TripPoint)
tripSavedForRepost()
Called if at the end of the trip, the trip couldn't be sent to DriveQuant's server for the analysis, for example when the smartphone has no network. The trip is saved locally on the SDK and will automatically be sent later.
beaconDetected()
Called when a beacon sets in the SDK is detected.
significantLocationChangeDetected()
Called when a user significant location change is detected.
sdkStateChanged(state: State)
crashDetected(crashInfo: DKCrashInfo)
crashFeedbackSent(crashInfo: DKCrashInfo, feedbackType: DKCrashFeedbackType, severity: DKCrashFeedbackSeverity)
tripFinished(post: PostGeneric, response: PostGenericResponse)
This method is called when a trip has been recorded by the SDK and analyzed by the DriveQuant's servers.
End of trip notification: Depending on the trip analysis service's response in the tripFinished()
callback, we recommend that you specify the notification content if you decide to display a user feedback:
For a vehicle trip, you can display a message such as: Your trip has been analyzed
.
For a trip by rail it is better to display the following message: Your trip was made by train.
Once the DriveQuant servers has analyzed a trip, the tripFinished()
callback is triggered with the data in the PostGenericResponse
object.
It can be useful to check the trip response status in order to check for example if the trip is valid or not with detailed information.
To do this, call the following method:
The TripResponseStatus model is described in the References part.
Go to the Capabilities tab of your target settings.
Turn on Background Modes and enable Location updates.
As DriveKit requires a user's location and motion data, it is required to get permissions from the user.
When the application requests permission for background locations or motion activities, a message will be shown to the user. You must configure this message by changing the value for the following keys in Info.plist
NSLocationWhenInUseUsageDescription
NSLocationAlwaysAndWhenInUseUsageDescription
NSMotionUsageDescription
Since iOS 13 and DriveKit SDK 1.1.3, location permission must be requested in two steps because the "Always Allow" option is no longer available in standard iOS location permission alert. You must first request when in use authorization (locationManager.requestWhenInUseAuthorization()
) and then ask the user to choose "Always Allow" option in the app settings and redirect user to the app settings page.
To ask for the location permission in a proper way, DriveKit provides the following function:
By default, the SDK incorporates the permission request to access Motion and Fitness. This allows for improved transportation mode recognition through the use of activity recognition based on motion properties.
Therefore, if you install DriveKit in your application, a permission request will be displayed to ask for the user's consent.
If you do not want to use this feature and want to control the user experience related to the Motion and Fitness permission request, it can be disabled.
To deactivate the Motion and Fitness permission request, call:
The automatic mode detects vehicle movements and triggers the trip analysis without driver intervention while the application is in background. The analysis is stopped automatically at the end of the trip.
This feature is recommended to avoid driver distraction and phone handling while driving. The automatic mode has been optimized to limit the battery drain.
By default, automatic trip detection is disabled, but you can enable it by calling the following method:
To disable automatic trip detection call the same method with parameter enable
set to false
If a trip is running when automatic trip detection is disable, the trip will not be canceled. If you want to cancel the trip, you should also call cancelTrip
method.
You can start a trip by calling the following method:
You can stop a trip by calling the following method. The trip will be stopped instantly:
If you want to cancel a trip, you can call this method:
To obtain a more precise analysis on driving behavior, it's recommended to configure the vehicle used by the driver. You can do this by calling the following method:
A detailed description of vehicle parameter is available here.
Two methods are available to determine SDK state.
This method returns false
if the SDK is in inactive
state, and no trip is currently running.
If you want a more detailed state of the SDK, you can call the following method:
This method returns the state of the SDK:
inactive
: No trip is running.
starting
: The auto start mode detects a movement of the user and checks if it's a trip in vehicle.
running
: The trip has been confirmed by the speed of the movement.
stopping
: The SDK is in this state when a potential trip end is detected. If the trip continues, the SDK goes back in running
state. The duration of the stopping state can be configured.
sending
: The trip is finished and is being sent to DriveQuant's server. When the SDK has the response from the server, the state becomes inactive
waiting for the next trip.
When a trip analysis is starting, you may need some information about it, like the StartMode
which triggers the trip recording, a local unique identifier of the trip that has not yet been analyzed by the DriveQuant’s servers, etc.
To retrieve information about the current trip, use the following method:
localTripId
String
Local and unique trip identifier generated by DriveKit SDK.
⚠️ It is different from the itinId
property returned in the Trip object. itinId
corresponds to the unique trip identifier generated after the data analysis.
date
Date
Start date of the trip analysis.
startMode
StartMode
Trip Analysis SDK have a repost mechanism, in most cases, when a trip is finished it is sent to DriveQuant's server to be analyzed and once it's done, the result of the analysis is sent back to the SDK.
In some case, the trip can't be sent to the server (no network for example). In this case, the SDK will save the trip data locally, to send it later. A retry will be attempted when the next trip will start.
If you want to check if there is locally saved trips and if they can be sent to the server, you can call the following method:
A trip being analyzed is automatically stopped after a period of inactivity (which begins when the vehicle has stopped). The DriveQuant SDK allows to set the end-of-trip duration.
By default, the trip analysis is stopped after 240 seconds. This value can be tuned according to your need and you can choose any integer values between 120 and 480 seconds by calling the following method:
If a value greater than 480 is set, the value will be forced to 480.
If a value lower than 120 is set, the value will be forced to 120.
Thanks to the driving location sharing feature, a user can generate a link that directs to a map displaying its location while driving. Location sharing provides peace of mind to family members during a trip. This section describes the methods to manage the location-sharing link.
If the trip sharing feature is enabled for your company, your API key carries out the feature access and a trip sharing link can be generated.
To check if the trip sharing feature is available for your API key, you can call the following code:
To generate a link to share trips, use the following code:
The method takes a durationInSeconds
parameter which indicates how long in seconds from now the sharing link will be valid.
success
The link has been successfully created. Information is returned in data
.
activeLinkAlreadyExists
A link already exists for this user.
Information returned in data
is nil.
error
An error occurred, for instance when the user has no network.
Information returned in data
is nil.
userNotConnected
The user is not yet connected to DriveKit. Information returned in data
is nil.
invalidDuration
An error occurred when trying to create a link. The duration parameter must be strictly greater than 0. Information returned in data
is nil.
unauthenticated
The user has been disconnected.
Information returned in data
is nil.
forbidden
Your API key is not allowed to use the feature.
Information returned in data
is nil.
code
String
Unique trip sharing code.
url
String
URL of the map that will display the current trip of the user.
startDate
Date
Link validity start date
endDate
Date
Link expiration date.
To retrieve a link to share trips, use the following code:
The method takes a synchronizationType
parameter. It will retrieve locally stored data if the value is .cache
, otherwise with the .defaultSync
value it will call the DriveQuant’s servers.
success
The link has been successfully retrieved. Information is returned in data
.
failedToGetCacheOnly
An error occurred when trying to retrieve a link. Locally trip sharing link, if exists, is returned in data.
noActiveLink
There is no active link for the user.
Information returned in data
is nil.
userNotConnected
The user is not yet connected to DriveKit. Information returned in data
is nil.
unauthenticated
The user has been disconnected.
Information returned in data
is nil.
forbidden
Your API key is not allowed to use the feature.
Information returned in data
is nil.
To revoke a trip sharing link, use the following code:
success
The link has been successfully revoked.
noActiveLink
There is no active link for the user.
error
An error occurred when trying to revoke the link.
userNotConnected
The user is not yet connected to DriveKit.
unauthenticated
The user has been disconnected.
forbidden
Your API key is not allowed to use the feature.
This feature allows you to share to the server the location of a driver during all his trips. It is different from the trip sharing with a link feature where the user chooses to share his trips for a certain duration, thanks to a link showing his current trip on a map.
The Trip Analysis SDK records the trip locally while it is in progress. The data are recorded with a period of one point per second. At the end of the trip, the SDK requests the driving analysis service and then retrieves the driving indicators.
In addition to this feature, the SDK is also able to share data with the server before the journey is completed. The data is transmitted at a lower frequency with a time interval of one point per minute.
The system for sharing information during the trip can be used in a vehicle fleet management system. This feature requires access to specific APIs. For more information, contact DriveQuant.
Sharing information with the server allows you to store the trip data even if it's been interrupted and the data post could not be performed at the end of the trip. This can happen in very rare cases such as the destruction of the mobile phone for instance.
By default, this setting is disabled but you can enable it by calling the following method:
To disable this setting, call the same method with the parameter set to false
Here is the list of data shared every minute by the SDK:
Date of trip start.
Duration of the trip in seconds.
Distance traveled in km.
Longitude of the current location.
Latitude of the current location.
Smartphone battery level.
Start-Mode for trip recording: manual, GPS-based or beacon-based.
Beacon parameters: uuid, major, minor.
DriveKit's automatic start mode detects a trip and launches its recording immediately. This operating mode may not be appropriate for all use cases.
Your application may require other information or business logic before enabling the trip recording. For example, it may be appropriate to check that:
A connected device is near to the smartphone.
The trip recording is acceptable in a given time slot.
In this case, you may want to subscribe to the events that are indicative of the trip start but not necessarily launch the GPS sensor and the trip analysis.
This is why DriveKit allows you to subscribe to trigger events that indicate that a trip has probably started.
By default, this feature is disabled.
To enable this feature, DriveKit Trip Analysis should not be configured in automatic mode but in manual mode.
If DriveKit Trip Analysis is set to automatic mode, the trip will be recorded.
If DriveKit Trip Analysis is set to manual mode and you follow the instructions below, you will be able to listen for trip start trigger events but the trip analysis will not be started automatically.
To listen to trigger events that indicate a start of trip, even if the autostart is disabled, you can call the following method:
Once the feature is enabled, events will be available in the TripListener potentialTripStart()
callback.
The potentialTripStart()
method can return all StartMode values ; except MANUAL
. Indeed, a trip manually started is considered as confirmed.
This function returns the location of the end of the last trip recorded by the user.
The location is defined by GPS coordinates (latitude and longitude), along with the end date of the last trip and an accuracy indicator for the GPS reading.
You can use the end-of-trip coordinate for a variety of purposes, for example:
help the user find his vehicle
alert the customer that the user has reached a specific destination
create a region monitoring (also known as geofencing) to locate the vehicle
To retrieve the location at which the last recorded trip ended, use the following method:
date
Date
Date of the end of trip.
latitude
Double
Latitude of the end of the trip.
longitude
Double
Longitude of the end of the trip.
accuracyMeter
Double
GPS data accuracy value in meters.
func getAccuracyLevel()
DKCoordinateAccuracy
GPS data accuracy level. Possible values are described below.
For ease of use, this function provides a position accuracy indicator with a 3-level scale.
good
The GPS accuracy is strictly below 10 meters.
fair
The GPS accuracy is between 10 and 30 meters.
poor
The GPS accuracy is strictly above 30 meters.
The automatic trip detection feature is compliant with iBeacon Bluetooth beacons. A beacon is a Bluetooth low energy (BLE) device that broadcasts a universally unique identifier. This signal can be detected by the SDK and used to trigger the trip analysis.
In addition, the beacon is a smart and cost-effective solution for identifying the vehicle in which the driver is travelling.
You can add beacon identifiers to Trip Analysis SDK by calling the following method:
Since iOS13, iOS beacon functions have some limitations, therefore all configured beacons must have the same proximity UUID.
On iOS, there is a limitation of 20 regions (including beacons) that can be monitored. Consequently, make sure that you limit to the minimum the number of beacons configured in the SDK.
To avoid the recording of unwanted trips (trips performed outside the vehicle where the beacon is placed), it is possible to automatically cancel the trip if the beacon is not "seen" several times during the trip. Generally, a trip will be cancelled in less than 6 minutes if the beacon is not in the vehicle.
By default, this setting is disabled, but you can enable it by calling the following method:
To disable this settings, call the same method with the parameter set to false
In very rare cases, it may be useful to avoid trip detection using the beacon but still need to validate the trip recording only if the beacon is near the smartphone during the trip.
In this case, the beacon is used in trip validation mode but not in trip detection mode.
If this advanced configuration is not used correctly, it may result in poor trip detection performance.
Please never use this feature without contacting DriveQuant to explain your use case and ensure that this particular mode is mandatory.
By default, if you have configured a beacon, its detection by the SDK will start a trip analysis.
In very rare cases (e.g. beacon in a vehicle and parked in close proximity to a living area), it might be useful to avoid the SDK to start a trip when a beacon is detected to reduce smartphone battery consumption.
Please note that beacon scans checks are always performed during the trip analysis, even if the configuration is called.
To disable the ability to start a trip analysis when a beacon is detected by DriveKit, you can call the following method:
For this functionality to work properly, the user must allow access to Bluetooth and you have to configure your project to allow background access to Bluetooth as described below.
In your target, in the "Signing & Capabilities" tab, you need to check the "Uses Bluetooth LE accessory" box in "Background Modes":
Ask the user for Bluetooth access authorization if it is not already granted. To do this, you can call this method:
The App Store review team may need to know why the "Uses Bluetooth LE accessory" background mode is needed for your app. To prevent your app from being temporary rejected by Apple during the review process, you should add a note like this in "App Review Information" > "Notes" section of App Store Connect:
Why is "bluetooth-central" UIBackgroundModes needed?
If the user has configured a vehicle with "Beacon" autostart mode and a trip analysis has been launched thanks to the detection of this beacon, we scan Bluetooth LE peripherals to retrieve the battery level of the beacon and send it to our backend to eventually warn the user to change his beacon if the battery level is low. Since the trip analysis is usually done in background, we need this UIBackgroundModes.
Crash detection features, included into the DriveKit Trip Analysis component, is able to collect and analyse smartphone sensors data to automatically detect when a car accident occurs.
DriveKit Trip Analysis analyzes signals from the GPS sensor and also from the motion sensors (accelerometer, gyrometer and magnetometer).
This feature is enabled if the following conditions are fulfilled:
Your API key has the access rights to use this service;
You have enabled the feature by following the instructions described in this section;
A trip has been detected and is being analysed.
The smartphone's sensors are functional.
The SDK is able to check the status of the required sensors.
The crash detection steps are:
A trip is detected automatically or started manually and the trip recording starts.
The crash feature detects a potential collision based on motion sensors.
The GPS and motion data are pushed to the backend analysis services in charge of the signal processing and crash confirmation.
The SDK receives a crash analysis service response with a status.
If the crash is confirmed, the Trip analysis component can display a survey to ask the driver whether he needs assistance. This is an optional feature.
If the crash detection configuration is enabled for your company, your API key carries out the feature access and the crash detection will be enabled accordingly.
However, you can deactivate and reactivate the function if necessary using a dedicated setting.
A method is available in DriveKitTripAnalysis
to enable or disable the feature:
It is possible to check if the crash detection is available for your configuration by checking the following property:
This property returns true
if:
the required smartphone sensors are available and up and running;
your API key is allowed to use the feature;
Trip Analysis offers a mechanism to ask the user for feedback when an accident is confirmed by the crash analysis service. Crash confirmation can be used to trigger a notification or display a screen which asks the driver to confirm the accident and whether assistance is required.
To disable the crash detection feedback, call the following method:
TripListener protocol provides two callbacks for crash events:
To receive these callbacks, the smartphone must be connected to a mobile network and the accident detection feature must be enabled for your organisation's API key.
The TripListener
interface provides useful information and events about trips analyzed by DriveKit.
For example, you can be informed when a trip analysis has started, finished, canceled, when a crash is detected, etc.
You can remove a specific listener using the following method:
To remove all TripListeners objects:
Do not forget to remove your TripListener
objects when you don't need it anymore to prevent memory leaks.
TripListener
interface includes several methods to implement:
End of trip notification: Depending on the trip analysis service's response in the tripFinished()
callback, we recommend that you specify the notification content if you decide to display a user feedback:
For a vehicle trip, you can display a message such as: Your trip has been analyzed
.
For a trip by rail it is better to display the following message: Your trip was made by train.
Once the DriveQuant servers has analyzed a trip, the tripFinished()
callback is triggered with the data in the PostGenericResponse
object.
It can be useful to check the trip response status in order to check for example if the trip is valid or not with detailed information.
To do this, call the following method:
Crash detection features, included into the DriveKit Trip Analysis component, is able to collect and analyse smartphone sensors data to automatically detect when a car accident occurs.
DriveKit Trip Analysis analyzes signals from the GPS sensor and also from the motion sensors (accelerometer, gyrometer and magnetometer).
This feature is enabled if the following conditions are fulfilled:
Your API key has the access rights to use this service;
You have enabled the feature by following the instructions described in this section;
A trip has been detected and is being analysed.
The smartphone's sensors are functional.
The SDK is able to check the status of the required sensors.
The crash detection steps are:
A trip is detected automatically or started manually and the trip recording starts.
The crash feature detects a potential collision based on motion sensors.
The GPS and motion data are pushed to the backend analysis services in charge of the signal processing and crash confirmation.
The SDK receives a crash analysis service response with a status.
If the crash is confirmed, the Trip analysis component can display a survey to ask the driver whether he needs assistance. This is an optional feature.
If the crash detection configuration is enabled for your company, your API key carries out the feature access and the crash detection will be enabled accordingly.
However, you can deactivate and reactivate the function if necessary using a dedicated setting.
A method is available in DriveKitTripAnalysis
to enable or disable the feature:
It is possible to check if the crash detection is available for your configuration by checking the following property:
This property returns true
if:
the required smartphone sensors are available and up and running;
your API key is allowed to use the feature;
Trip Analysis offers a mechanism to ask the user for feedback when an accident is confirmed by the crash analysis service.
Crash confirmation can be used to trigger a notification or display a screen which asks the driver to confirm the accident and whether assistance is required.
To disable the crash detection feedback, call the following method:
TripListener
interface provides two callbacks for crash events:
To receive these callbacks, the smartphone must be connected to a mobile network and the accident detection feature must be enabled for your organisation's API key.
It is required to ask the user for location permission. Find below an example of how to ask location permission:
If location permission is not granted by the user, Trip Analysis SDK will not work.
For device running Android 10 and above, it's required to ask the user for activity recognition permission. Find below an example of how to ask the permission:
If activity recognition permission is not granted by the user, Trip Analysis component will not work.
It is required to ask the user to disable battery optimization for your app. Without battery optimization disabled, Trip Analysis SDK will not work properly.
Call the following code after explaining to the user why disabling battery optimization is required:
If battery optimization is enabled, trip recording will not work.
If Nearby Devices permission is not granted by the user, Trip Analysis component won't work correctly.
Find below an example of how to ask the Notification permission:
First, declare the permission in your Manifest app file:
Then request the permission on your UI:
If the permission is not granted, the user will not receive full-screen notifications when the smartphone is locked, but instead an expanded heads-up notification on lockscreen. Find below an example of how to ask the full-screen intent permission:
First, declare the permission in your Manifest app file:
Then request the permission on your UI:
Trip Analysis component requires Google Play Services Location 21.0.1
or above.
You can check if Play Services are available on the device with the following code:
The automatic trip detection feature is compliant with iBeacon Bluetooth beacons. A beacon is a Bluetooth low energy (BLE) device that broadcasts a universally unique identifier. This signal can be detected by the SDK and used to trigger the trip analysis.
In addition, the beacon is a smart and cost-effective solution for identifying the vehicle in which the driver is travelling.
You can add beacon identifiers to Trip Analysis module by calling the following method:
To avoid the recording of unwanted trips (trips performed outside the vehicle where the beacon is placed), it is possible to automatically cancel the trip if the beacon is not "seen" several times during the trip. Generally, a trip will be cancelled in less than 6 minutes if the beacon is not in the vehicle.
By default, this setting is disabled but you can enable it by calling the following method:
To disable this settings, call the same method with the parameter set to false
In very rare cases, it may be useful to avoid trip detection using the beacon but still need to validate the trip recording only if the beacon is near the smartphone during the trip.
In this case, the beacon is used in trip validation mode but not in trip detection mode.
If this advanced configuration is not used correctly, it may result in poor trip detection performance.
Please never use this feature without contacting DriveQuant to explain your use case and ensure that this particular mode is mandatory.
By default, if you have configured a beacon, its detection by the SDK will start a trip analysis.
In very rare cases (e.g. beacon in a vehicle and parked in close proximity to a living area), it might be useful to avoid the SDK to start a trip when a beacon is detected to reduce smartphone battery consumption.
Please note that beacon scan checks are always performed during the trip analysis, even if the configuration is called.
To disable the ability to start a trip analysis when a beacon is detected by DriveKit, you can call the following method:
TripNotification
is an object that contains the configuration of the foreground notification displayed during a trip recording.
To configure the trip notification in your app, call the following code:
The cancelIconId and cancel parameters must be set if the enableCancel parameter is set to true.
By default, the trip autostart feature is disabled.
To enable automatic trip detection, call the following method with parameter activate
set to true
.
You can start a trip by calling the following method:
You can stop a trip by calling the following method. The trip will be stopped instantly:
If you want to cancel a trip, you can call this method:
To obtain a more precise analysis on driving behavior, it's recommended to configure the vehicle used by the driver. You can do this by calling the following method:
Two methods are available to determine SDK state.
This method returns false
if the SDK is in INACTIVE
state, and no trip is currently running.
If you want a more detailed state of the SDK, you can call the following method:
This method returns the state of the SDK:
INACTIVE
: No trip is running.
STARTING
: The auto start mode detects a movement of the user and checks if it's a trip in vehicle.
RUNNING
: The trip has been confirmed by the speed of the movement.
SENDING
: The trip is finished and is being sent to DriveQuant's server. When the SDK has the response from the server, the state becomes INACTIVE
waiting for the next trip.
When a trip recording is starting, you may need some information about it, like the StartMode
which triggers the trip recording, a local unique identifier of the trip that has not yet been analyzed by the DriveQuant’s servers, etc.
To retrieve information about the current trip, use the following method:
Trip Analysis SDK have a repost mechanism. In most cases, when a trip is finished, it is sent to DriveQuant's server for analysis. Once it's done, the result of the analysis is sent back to the SDK.
In some case, the trip can't be sent to DriveQuant's server (for example, when there is no network). In this case, the SDK will save the trip data locally to send it later.
An automatic retry will be attempted later when you are connected to network.
You can manually check whether trips are to be sent to the DriveQuant servers using the following method:
After a trip cancel, the automatic start function will not restart a new trip recording if the user has not walked. Without this mechanism, if the user cancels a trip recording because he is on public transport and not driving, the trip will restart immediately.
A trip being analyzed is automatically terminated after a period of inactivity (which begins when the vehicle has stopped). The SDK allows to set the end-of-trip duration.
By default, the trip analysis is stopped after 240 seconds. This value can be tuned according to your need and you can choose any integer values between 120 and 480 seconds by calling the following method:
If a value greater than 480 is set, the value will be forced to 480.
If a value lower than 120 is set, the value will be forced to 120.
Thanks to the driving location sharing feature, a user can generate a link that directs to a map displaying its location while driving. Location sharing provides peace of mind to family members during a trip. This section describes the methods to manage the location-sharing link.
If the trip sharing feature is enabled for your company, your API key carries out the feature access and a trip sharing link can be generated.
To check if the trip sharing feature is available for your API key, you can call the following code:
To generate a link to share trips, use the following code:
The method takes a durationInSeconds
parameter which indicates how long in seconds from now the sharing link will be valid.
To retrieve a link to share trips, use the following code:
The method takes a synchronizationType
parameter. It will retrieve locally stored data if the value is CACHE
, otherwise with the DEFAULT
value it will call the DriveQuant’s servers.
To revoke a trip sharing link, use the following code:
The Trip Analysis component records the trip locally while it is in progress. The data are recorded with a period of one point per second. At the end of the trip, the SDK requests the driving analysis service and then retrieves the driving indicators.
In addition to this feature, the SDK is also able to share data with the server before the trip is completed. The data is transmitted at a lower frequency with a time interval of one point per minute.
Sharing information with the server allows you to store the trip data even if it has been interrupted, and if the data post at the end of the trip could not be performed. This can happen in very rare cases such as the destruction of the mobile phone.
By default, this setting is disabled but you can enable it by calling the following method with parameter enable
to true
:
To disable this setting, call the same method with the parameter set to false
Here is the list of data shared every minute by the SDK:
Date of trip start.
Duration of the trip in seconds.
Distance traveled in km.
Longitude of the current location.
Latitude of the current location.
Smartphone battery level.
StartMode of the trip recording: manual, GPS-based or beacon-based.
Beacon parameters: uuid, major, minor.
DriveKit's automatic start mode detects a trip and launches its recording immediately. This operating mode may not be appropriate for all use cases.
Your application may require other information or business logic before enabling the trip recording. For example, it may be appropriate to check that:
A connected device is near to the smartphone.
The trip recording is acceptable in a given time slot.
In this case, you may want to subscribe to the events that are indicative of the trip start but not necessarily launch the GPS sensor and the trip analysis.
This is why DriveKit allows you to subscribe to trigger events that indicate that a trip has probably started.
By default, this feature is disabled.
To enable this feature, DriveKit Trip Analysis should not be configured in automatic mode but in manual mode.
If DriveKit Trip Analysis is set to automatic mode, the trip will be recorded.
If DriveKit Trip Analysis is set to manual mode and you follow the instructions below, you will be able to listen for trip start trigger events but the trip analysis will not be started automatically.
To listen to trigger events that indicate a start of trip, even if the autostart is disabled, you can check the following property:
The potentialTripStart()
method can return all StartMode values ; except MANUAL
. Indeed, a trip manually started is considered as confirmed.
This function returns the location of the end of the last trip recorded by the user.
The location is defined by GPS coordinates (latitude and longitude), along with the end date of the last trip and an accuracy indicator for the GPS reading.
You can use the end-of-trip coordinate for a variety of purposes, for example:
help the user find his vehicle
alert the customer that the user has reached a specific destination
create a geofence to locate the vehicle
To retrieve the location at which the last recorded trip ended, use the following method:
For ease of use, this function provides a position accuracy indicator with a 3-level scale.
This method is now deprecated.
It is now possible to retrieve the start mode of the current trip using the getCurrentTripInfo()
method.
after calling the DriveKit SDK's method.
DKTripRecordingStartedState
object is described .
Called each time a trip is confirmed.
DKTripRecordingConfirmedState
object is described .
DKTripRecordingCanceledState
object is described .
Called when trip recording has ended, before sending trip data to DriveQuant's servers.
DKTripRecordingFinishedState
object is described .
object contains the trip analysis made on DriveQuant's server.
Called when a trip is started and confirmed, for each GPS point recorded by the SDK. Data available in TripPoint
object are described .
Called every time the state of the SDK changed with the new state as parameter. States are described .
Called when a crash event is detected. Triggered if Crash Detection is enabled. Read more
called when crash feedback is enabled and a confirmed crash is detected. Triggered if Crash Detection is enabled. Read more
tripStarted(startMode: StartMode)
This method has been deprecated to be replaced by: tripRecordingConfirmed(state: DKTripRecordingConfirmedState)
Called each time a trip is started. StartMode
indicates which event starts the trip. Possible values are described .
tripCancelled(cancelTrip: CancelTrip)
This method has been deprecated to be replaced by: tripRecordingCanceled(state: DKTripRecordingCanceledState)
Called when a trip is cancelled. CancelTrip
indicates which event cancels the trip. Possible values are described .
This method has been deprecated to be replaced by: tripFinished(responseStatus: TripResponseStatus)
PostGeneric
object contains raw data sent to DriveQuant's server, PostGenericResponse
object contains the trip analysis made on DriveQuant's server. Detailed description of these data are available .
⚠️ It is different from the startDate property returned in the object.
The which triggered the trip analysis.
💡 You have to call the method to in your workflow.
The DriveKit SDK is fully compatible with the standard.
A detailed description of BeaconData
class is available .
"Regions are shared resources that rely on specific hardware capabilities. To ensure that all apps can participate in region monitoring, Core Location prevents any single app from monitoring more than 20 regions simultaneously."
If you have configured the beacon and the as required, trips will be recorded if at least a beacon or a bluetooth device is detected during the trip.
DriveKit is able to retrieve the battery level of a beacon and to add this information automatically in (only for the current trip), so that you can know, for instance, if the beacon battery of a user needs to be changed.
Getting the beacon battery level is not essential and if the Bluetooth access permission is not granted or your project not configured as mentioned below, the battery level will not be retrieved but this has no impact on the .
The crash detection comes with an optional user interface to display an alert to the driver. This is described in the section.
To use this function, you simply need to enable the interface with the following method and a object:
crashDetected(crashInfo:
)
, called when a crash event is detected
crashFeedbackSent(crashInfo:
, feedbackType:
, severity:
)
, called when crash feedback is enabled and a confirmed crash is detected. This callback will contain crash information and the feedback from the user.
The trip recording lifecycle is exhaustively described in part.
The callback method tripFinished(post: PostGeneric, response: PostGenericResponse)
is replaced by tripFinished(result: TripResult)
which directly provides the useful information (see ).
The model is described in the References part.
The crash detection comes with an optional feature to display an alert to the driver. This is described in the section.
To use this function, you need to enable the interface with the following method and a object:
To display a full-screen intent notification when a crash is detected while the phone is locked, your must declare that permission in the manifest of your app and runtime request the user to grant it. Learn more .
crashDetected(crashInfo:
)
, triggered when a crash event is detected
crashFeedbackSent(crashInfo:
, feedbackType:
, severity:
)
, triggered when crash feedback is enabled and a confirmed crash is detected. This callback will contain crash information and the feedback from the user.
The SDK usage is included into acceptable use cases for requesting or being on the Battery Optimizations exceptions whitelist. For more information you can read the Android developer documentation on .
Some manufacturers add other battery optimizations. You can find tutorials on how to disable these battery optimizations for main Android device manufacturers .
For devices running Android 12 and above, it's required to ask the user for . Find below an example of how to ask Nearby Devices permission:
For devices running Android 13 and above, it's required to ask the user for . If the permission is not granted, the user will not receive notifications.
For Android 14 devices and above, it is now necessary to ask the user for this permission to display full screen notification for the feature.
The DriveKit SDK is fully compatible with the standard.
A detailed description of BeaconData
class is available .
If you have configured the beacon and the as required, trips will be recorded if at least a beacon or a bluetooth device is detected during the trip.
If a trip is running when automatic trip detection is disabled, the trip will not be canceled. If you want to cancel the trip, you should also call method.
A detailed description of vehicle parameter is available .
STOPPING
: The SDK is in this state when a potential trip end is detected. If the trip continues, the SDK goes back in RUNNING
state. The can be configured.
This feature allows you to share to the server the location of a driver during all his trips. It is different from the feature where the user chooses to share his trips for a certain duration, thanks to a link showing his current trip on a map.
The system for sharing information during the trip can be used in a vehicle fleet management system. This feature requires access to specific APIs. For more information, .
Once the feature is enabled, events will be available in the potentialTripStart()
callback.
Trip Analysis offers a method to retrieve the of the current trip. The method returns null
if no trip is running.
title
String
Title of the notification
content
String
Content of the notification
iconId
Int
The icon Android resource identifier for notification
channelName
String
Name of the Android notification channel which is displayed in the app's notification settings.
If not set, the channel name takes the value of title
attribute
channelId
String
Identifier of the Android notification channel used. The default value is dq_sdk_channel
notificationId
Int?
The identifier of the foreground notification. If not set, the value is a strictly positive random integer and changes every time a trip recording is running.
contentIntent
PendingIntent?
The Intent which will be launched when the user taps on the notification. Default value is null
.
enableCancel
Boolean
If true
, a cancel button will be displayed in notification that cancels the trip when pressed.
Default value is false
.
cancel
String?
Text of the cancel button.
Default value is null
.
cancelIconId
Int?
Icon resource of the cancel button.
Default value is null
.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK.
⚠️ It is different from the itinId
property returned in the Trip object. itinId
corresponds to the unique trip identifier generated after the data analysis.
date
Date
Start date of the trip recording.
⚠️ It is different from the startDate property returned in the Trip object.
startMode
StartMode
The StartMode which triggered the trip recording.
SUCCESS
The link has been successfully created. Information is returned in data
.
ACTIVE_LINK_ALREADY_EXISTS
A link already exists for this user.
Information returned in data
is null.
💡 You have to call the method to retrieve an existing link in your workflow.
ERROR
An error occurred, for instance when the user has no network.
Information returned in data
is null.
USER_NOT_CONNECTED
The user is not yet connected to DriveKit. Information returned in data
is null.
INVALID_DURATION
An error occurred when trying to create a link. The duration parameter must be strictly greater than 0. Information returned in data
is null.
UNAUTHENTICATED
The user has been disconnected.
Information returned in data
is null.
FORBIDDEN
Your API key is not allowed to use the feature.
Information returned in data
is null.
code
String
Unique trip sharing code.
url
String
URL of the map that will display the current trip of the user.
startDate
Date
Link validity start date
endDate
Date
Link expiration date.
SUCCESS
The link has been successfully retrieved. Information is returned in data
.
FAILED_TO_GET_CACHE_ONLY
An error occurred when trying to retrieve a link. Locally trip sharing link, if exists, is returned in data.
NO_ACTIVE_LINK
There is no active link for the user.
Information returned in data
is null.
USER_NOT_CONNECTED
The user is not yet connected to DriveKit. Information returned in data
is null.
UNAUTHENTICATED
The user has been disconnected.
Information returned in data
is null.
FORBIDDEN
Your API key is not allowed to use the feature.
Information returned in data
is null.
SUCCESS
The link has been successfully revoked.
NO_ACTIVE_LINK
There is no active link for the user.
ERROR
An error occurred when trying to revoke the link.
USER_NOT_CONNECTED
The user is not yet connected to DriveKit.
UNAUTHENTICATED
The user has been disconnected.
FORBIDDEN
Your API key is not allowed to use the feature.
date
Date
Date of the end of trip.
latitude
Double
Latitude of the end of the trip.
longitude
Double
Longitude of the end of the trip.
accuracyMeter
Double
GPS data accuracy value in meters.
fun getAccuracyLevel()
DKCoordinateAccuracy
GPS data accuracy level. Possible values are described below.
GOOD
The GPS accuracy is strictly below 10 meters.
FAIR
The GPS accuracy is between 10 and 30 meters.
POOR
The GPS accuracy is strictly above 30 meters.
Bluetooth wireless technology is a common solution in modern vehicles. Most drivers know that by pairing their Bluetooth smartphone with their car stereo receiver, they will be able to make hands-free calls or to stream their music to the car audio system.
Once the smartphone's paired with the vehicle, it automatically connects to it if the vehicle is started.
Trip Analysis SDK is capable of detecting this event to start a trip analysis.
A Bluetooth device is identified by a unique MAC address and an optional name. It can be detected by the SDK and used to trigger the trip analysis.
The use of the vehicle Bluetooth detection is a simple and cost-effective solution to identify the trips made with your vehicle.
You can retrieve all Bluetooth devices paired to the smartphone by calling the following method:
Bluetooth device will be seen only if the iPhone is connected to the vehicle bluetooth when this functions is called.
You can add Bluetooth devices to Trip Analysis SDK by calling the following method:
A detailed description of BluetoothData class is available here.
Pairing the vehicle's Bluetooth system improves the trip detection and analysis. With this feature you can decide to enable or disable the trip recording when the Bluetooth device is not connected. There are two possibilities:
the trip can be recorded even if the smartphone is not connected to the Bluetooth device.
the trip recording will be cancelled if the smartphone is not connected to the Bluetooth device.
This choice depends on your use case. In general, if you only want to record trips made with the vehicle equipped with the paired Bluetooth system, you must prefer the second choice.
To avoid trip recording when the Bluetooth device is not connected, call the following method:
To enable trip recording regardless of the state of the Bluetooth system (connected or not connected to the smartphone), call the following method:
If your use case requires it, it is possible to add your own data in the trip analysis request. For example, it can be data that is specific to your trip, application or user identification system.
Metadata is persisted, so if you want to send it only for one trip, you need to remove it at the end of the trip, on the sdkStateChanged(state: State)
callback, by checking if state
is INACTIVE
.
You can add additional metadata to your trip by calling the following method:
The metadata must be represented as a key/value object where the key and value have a String type.
The metadata can be set any time before the end of a trip.
If metadata is sent, it will also be added to the push data request in the metaData field.
It is possible to get a copy of configured metadata thanks to the following method on DriveKitTripAnalysis:
To update a value in metadata, call the following method:
To delete a specific value in metadata, call the following method:
To delete all values in metadata, call this method:
Bluetooth wireless technology is a common solution in modern vehicles. Most drivers know that by pairing their Bluetooth smartphone with their car stereo receiver, they will be able to make hands-free calls or to stream their music to the car audio system.
Once the smartphone's paired with the vehicle, it automatically connects to it if the vehicle is started.
Trip Analysis component is capable of detecting this event to start a trip analysis.
A Bluetooth device is identified by a unique MAC address and an optional name. It can be detected by the SDK and used to trigger the trip analysis.
The use of the vehicle Bluetooth detection is a simple and cost-effective solution to identify the trips made with your vehicle.
You can retrieve all Bluetooth devices paired to the smartphone by calling the following method:
You can add Bluetooth devices to Trip Analysis component by calling the following method:
A detailed description of BluetoothData class is available here.
Pairing the vehicle's Bluetooth system improves the trip detection and analysis. With this feature you can decide to enable or disable the trip recording when the Bluetooth device is not connected. There are two possibilities:
the trip can be recorded even if the smartphone is not connected to the Bluetooth device.
the trip recording will be cancelled if the smartphone is not connected to the Bluetooth device.
This choice depends on your use case. In general, if you only want to record trips made with the vehicle equipped with the paired Bluetooth system, you must prefer the second choice.
To avoid trip recording when the Bluetooth device is not connected, call the following method with parameter to true
:
To enable trip recording regardless of the state of the Bluetooth system (connected or not connected to the smartphone), call the following method with parameter to false
:
Before starting DriveKit Trip Analysis UI integration, make sure that you have initialized TripAnalysis and CommonUI modules, especially if you have disabled the SDK auto-initialization.
The Trip Analysis UI module is available on Cocoapods master repo. To access the framework in the repository, add the following lines to your Podfile:
Then, run pod install
.
If you have disabled the SDK auto-initialization, the Trip Analysis UI module must also be manually initialized. In the application's AppDelegate file, import DriveKitTripAnalysisUI:
Then, to initialize Trip Analysis UI SDK in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate:
The Working hours feature sorts the trips according to whether they are made during working hours. The trips are then automatically tagged as "BUSINESS" or "PERSONAL".
The feature also permits to set time slots during which the automatic starting mode is disabled, which offers more privacy control for the driver.
You can get that screen by calling the following method:
Before starting DriveKit Vehicle UI integration, make sure that TripAnalysis and CommonUI modules are initialized, especially if you have disabled the SDK auto-initialization.
To add the Trip Analysis UI module to your app, add the following lines to your dependencies in your application build.gradle file:
On a Github repository, you can find a demo app and the source code of Permissions Utils UI that you can use as an example.
If you have disabled the SDK auto-initialization, the Trip Analysis UI module must also be manually initialized.
Then, to initialize the Trip Analysis UI module in your app, you must call the initialization method in onCreate
method of your Application class:
tripRecordingStarted(state: DKTripRecordingStartedState)
Immediately called when a trip recording starts.
This callback is triggered:
after calling the DriveKit SDK's startTrip()
method.
after automatic trip detection.
DKTripRecordingStartedState
object is described here.
tripRecordingConfirmed(state: DKTripRecordingConfirmedState)
Called each time a trip is confirmed.
DKTripRecordingConfirmedState
object is described here.
tripRecordingCanceled(state: DKTripRecordingCanceledState)
Called when a trip recording is canceled. DKTripRecordingCanceledState
indicates which event has canceled the trip.
DKTripRecordingCanceledState
object is described here.
tripRecordingFinished(state: DKTripRecordingFinishedState)
Called when trip recording has ended, before sending trip data to DriveQuant's servers.
DKTripRecordingFinishedState
object is described here.
tripFinished(result: TripResult)
This method is called when a trip has been recorded by the SDK and analyzed by the DriveQuant's servers.
TripResult
object contains the trip analysis result made on DriveQuant's server.
tripPoint(tripPoint: TripPoint)
Called when a trip is started and confirmed, for each location point recorded by the SDK. Data available in TripPoint
object are described here.
tripSavedForRepost()
Called if at the end of the trip, the trip couldn't be sent to DriveQuant's server for the analysis, for example when the smartphone has no network. The trip is saved locally on the SDK and will automatically be sent later.
beaconDetected()
This method is called when a beacon sets in the SDK is detected.
sdkStateChanged(state: State)
This method is called every time the state of the SDK changed with the new state as parameter. States are described here.
crashDetected(crashInfo: DKCrashInfo)
Called when a crash event is detected. Triggered if crash detection is enabled. Read more here
crashFeedbackSent(crashInfo: DKCrashInfo, feedbackType: DKCrashFeedbackType, severity: DKCrashFeedbackSeverity)
Called when crash feedback is enabled and a confirmed crash is detected. Triggered if Crash Detection is enabled. Read more here
Called each time a trip has started and is confirmed. StartMode
indicates which event starts the trip.
Possible values are described here.
This method is called when a trip is cancelled. CancelTrip indicates which event cancels the trip. Possible values are described here.
tripFinished(post: PostGeneric, response: PostGenericResponse)
This method is called when a trip has been recorded by the SDK and analyzed by the DriveQuant's servers.
PostGeneric
contains raw data sent to DriveQuant's server, PostGenericResponse
object contains the trip analysis made on DriveQuant's server.
Detailed description of these data are available here.
onDeviceConfigEvent(deviceConfigEvent: DeviceConfigEvent)
This method is deprecated and will be removed in a future version. It is replaced by the DKDeviceConfigurationListener
. Read more here.
The Trip Analysis UI module is an open source graphical library created to incorporate a user interface for trip analysis management into your mobile application.
It contains 3 main features :
Working hours ;
Feedback crash detection ;
A widget to control the trip recording.
The working hours feature sorts the trips according to whether they are made during working hours.
If the driver activates the feature, he can determine for each day of the week the time slots on which he wants the trips to automatically be considered as:
professional,
personal,
or not recorded at all.
The TripAnalysis internal module contains a crash detection feature. Once activated, using the phone's sensors, the SDK is able to identify if a crash has occurred, and so help the emergency services to intervene.
To enhance this feature, the TripAnalysis UI module contains a graphical interface that can be activated. It informs the driver that a crash has been detected so he can confirm it and ask for assistance if needed.
The Trip Analysis user interface includes a widget to help the user to control the trip recording.
The appearance of the button is updated according to the trip status:
If there are no trip in progress, the user can manually start the trip analysis.
If a trip is being recorded, this component displays the start time of the trip, the duration of the recording and the travelled distance. In this case, the user can stop the analysis to obtain his or her driving scores.
Three options are proposed to the user if he clicks on the button while a trip is being recorded:
The user can declare that the trip is still in progress, in which case recording will continue.
The user can declare that he has completed his trip, in which case the trip will be analysed and he will receive his driving score.
The user can cancel the trip recording if he is not the driver, in this case the trip will not be analysed.
Location sharing while driving provides peace of mind to family members. The graphical interface helps the user to enable location sharing and create a link that displays his location on a map to a friend or family member while driving.
The feature is implemented across three distinct screens:
Introduction Screen: The feature is disabled by default. The first screen explains the location-sharing principle.
Duration Selection Screen: On the second screen, the user can choose the duration for sharing his trip location. The available options include one day, one week, or one month.
Active Sharing Screen: The last screen confirms that location sharing is active. It includes a button that allows the user to generate and share a link displaying his real-time location. Additionally, it displays the remaining time before the link expires.
To integrate and display this feature within your application, invoke the following method:
The crash detection feature includes an interface that informs the driver that a crash has been detected so he can confirm it to automatically call for help if needed.
By default, the crash detection feedback is disabled. When this feature is enabled, the crash detection feedback displays a notification or a screen and calls an emergency number when a crash is confirmed by the driver.
To enable crash detection feedback, the following method needs to be called:
With the following parameters:
DKCrashFeedbackConfig
DKCrashFeedbackNotification
DKCrashAlert
To disable crash detection feedback, call the following method:
To simulate a car accident, simply install the trip simulator and start a simulation with the configuration tripWithCrash
.
Our platform can share a collision report that contains information about the accident.
This information can be used to:
trigger the intervention of an assistance service,
and initiate the accident management process.
The widget is a button that let the user control the trip recording. Possible actions are:
Start a trip recording
Check that the current trip is being recorded
Stop a trip recording
Cancel a trip recording.
To integrate the trip recording widget into your application, simply add the code below:
The given viewController
is used to present the stop trip confirmation dialog when the user taps the button in trip in progress state.
It can also be used when you call the DKTripRecordingButton
public method showConfirmationDialog()
on your button instance. This is useful if you need to programmatically display the dialog (for example, when the user taps a start trip notification).
Warning: This dialog won’t appear if the DKTripRecordingUserMode
doesn’t allow the user to end a trip.
The button has 4 configurations to cover all possible scenarios, and its display can be adjusted using the tripRecordingUserMode
parameter.
.none
: The button is hidden and the trip recording is fully automatic. This is the simplest mode, and the one we prefer.
.startStop
: The button is displayed and the user has total control over the trip recording cycle: start, stop and cancel. In this configuration, autostart remains active.
.startOnly
: The user can start a trip manually but cannot stop or cancel it under any circumstances. Recording stops automatically. In this configuration, autostart remains active.
.stopOnly
: The user cannot start a trip manually. The start of a trip is detected automatically. The user can only stop the trip to get his results or cancel the recording if he is not the driver, for example.
The default value is .startStop
.
To set the button mode, call the following method before displaying the button:
tripStarted(startMode: StartMode)
This method has been deprecated to be replaced by: tripRecordingConfirmed(state: DKTripRecordingConfirmedState)
tripCancelled(cancelTrip: CancelTrip)
This method has been deprecated to be replaced by: tripRecordingCanceled(state: DKTripRecordingCanceledState)
This method has been deprecated to be replaced by: tripFinished(result: TripResult)
In order to check your integration and test the crash detection feature, you can use the trip simulator described in section
If you want to know more and if you need to collect crash data on your platform, we invite you to contact us by email at
roadsideAssistanceNumber
String
Emergency number that will be called if there is a crash.
config
DKCrashFeedbackConfig
Configuration of the feedback.
notification
DKCrashFeedbackNotification
Configuration of the notification.
crashVelocityThreshold
Double
Minimal speed when the crash occurred. For example, if crashVelocityThreshold is set at 20 km/h and a crash occurred at 10 km/h, feedback will not be sent to the user. Default value : 0.0 km/h
title
String
Title that appears on the notification.
message
String
Message that appears on the notification
crashAlert
DKCrashAlert
Object that describes how the user will be noticed when a feedback is asked. Default value : SILENCE
silence
Device will not vibrate or ring
vibration
Device will vibrate
soundAndVibration
Device will ring and vibrate
The Working hours feature sorts the trips according to whether they are made during working hours. The trips are then automatically tagged as BUSINESS
or PERSONAL
.
The feature also permits to set time slots during which the automatic starting mode is disabled, which offers more privacy control for the driver.
You can start displaying that screen by calling the following method:
The crash detection feature includes an interface that informs the driver that a crash has been detected so he can confirm it to automatically call for help if needed.
By default, the crash detection feedback is disabled. When this feature is enabled, the crash detection feedback displays a notification or a screen and calls an emergency number when a crash is confirmed by the driver.
To enable crash detection feedback, the following method needs to be called:
With the following parameters:
roadsideAssistanceNumber
String
Emergency number that will be called if there is a crash.
config
DKCrashFeedbackConfig
Configuration of the feedback.
DKCrashFeedbackConfig
notification
DKCrashFeedbackNotification
Configuration of the notification.
crashVelocityThreshold
Double
Minimal speed when the crash occurred. For example, if crashVelocityThreshold is set at 20 km/h and a crash occurred at 10 km/h, feedback will not be sent to the user. Default value : 0.0 km/h
DKCrashFeedbackNotification
title
String
Title that appears on the notification.
message
String
Message that appears on the notification
crashAlert
DKCrashAlert
Object that describes how the user will be noticed when a feedback is asked. Default value : SILENCE
DKCrashAlert
SILENCE
Device will not vibrate or ring
VIBRATION
Device will vibrate
SOUND_AND_VIBRATION
Device will ring and vibrate
To disable crash detection feedback, call the following method:
In order to check your integration and test the crash detection feature, you can use the trip simulator described in section simulate a crash during a trip.
To simulate a car accident, simply install the trip simulator and start a simulation with the configuration TRIP_WITH_CRASH
.
Our platform can share a collision report that contains information about the accident.
This information can be used to:
trigger the intervention of an assistance service,
and initiate the accident management process.
If you want to know more and if you need to collect crash data on your platform, we invite you to contact us by email at contact@drivequant.com
The widget is a button that lets the user control the trip recording. Possible actions are:
Start a trip recording
Check that the current trip is being recorded
Stop a trip recording
Cancel a trip recording.
There are two ways to integrate the trip recording widget into your application:
The first one is embedding it in XML layout:
The second way is getting it from DriveKitTripAnalysisUI
:
If you need to programmatically display the stop trip confirmation dialog (for example, when the user taps a start trip notification), you can call the public method showConfirmationDialog()
of the DKTripRecordingButton
instance.
Warning: This dialog won’t appear if the DKTripRecordingUserMode
doesn’t allow the user to end a trip.
The button has 4 configurations to cover all possible scenarios, and its display can be adjusted using the tripRecordingUserMode parameter.
NONE
: The button is hidden and the trip recording is fully automatic. This is the simplest mode, and the one we prefer.
START_STOP
: The button is displayed and the user has total control over the trip recording cycle: start, stop and cancel. In this configuration, autostart remains active.
START_ONLY
: The user can start a trip manually but cannot stop or cancel it under any circumstances. Recording stops automatically. In this configuration, autostart remains active.
STOP_ONLY
: The user cannot start a trip manually. The start of a trip is detected automatically. The user can only stop the trip to get his results or cancel the recording
The default value is START_STOP
.
To set the button mode, call the following method:
The Trip Simulator component includes two modules:
The first module is used as a testing tool for your debug application.
The second module is a “no-op” module. It will do nothing and does not include any trip data: it’s an empty implementation that mirrors the public methods and objects of the first module which can be integrated into your release-mode application to maintain a consistent codebase across both debug and release modes without embedding the real trip simulator in production.
To include the Trip Simulator module in your app, insert the following lines into the dependencies section of your application's build.gradle
file:
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.
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.
The user must enable the developer mode in Android. The official documentation explains well how to proceed.
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.
To simulate a trip, call the following method with a appropriate configuration with the PresetTrip
parameter.
To stop the trip simulation, you must call the following method:
Otherwise you can manually remove your app as the mock location app in the developers settings.
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:
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.
To check whether the "no-op" module is embedded, you can execute the following code:
To verify the DriveKit Trip Analysis component integration into your app, it is recommended to perform tests in real conditions.
Before carrying out driving tests, it may be useful to validate the implementation of the SDK in your application.
However, it is not possible to emulate GPS data from development tools such as Android Studio. It is possible to simulate a trip using the simulator in Xcode, but the trip options are very limited.
For this purpose, DriveQuant provides a trip simulation component based on recorded GPS data.
The Trip Simulator component allows to validate the following features:
the automatic start;
the trip recording life cycle;
graphical display after the end of the trip;
the application's behaviour in the case of alternative trips;
crash detection during a trip, with user’s feedback.
This section gives step-by-step instructions for integrating the DriveKit SDK test component into your application.
The Trip Simulator component includes two modules:
The first module is used as a testing tool for your debug application.
The second module is a “no-op” module. It will do nothing and does not include any trip data: it’s an empty implementation that mirrors the public methods and objects of the first module which can be integrated into your release-mode application to maintain a consistent codebase across both debug and release modes without embedding the real trip simulator in production.
To add the Trip Simulator module to your app, add the following lines to your dependencies in your Podfile, with the no-op module in release mode if you need it:
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
shortTrip
8 min
2 km
Trip too short that does not allow to rate the driver's behavior
mixedTrip
15 min
12 km
A 15-minute mixed trip in urban and suburban areas
cityTrip
20 min
8 km
A 20-minute city trip
suburbanTrip
30 min
30 km
A 30-minute trip performed in a suburban environment mostly
highwayTrip
55 min
100 km
A 55-minute highway trip
trainTrip
10 min
5 km
Trip recorded in a train to test the alternative transportation modes detection
busTrip
13 min
3 km
Trip recorded in a bus to test the alternative transportation modes detection
boatTrip
40 min
25 km
Trip recorded in a boat to test the alternative transportation modes detection
tripWithCrash
5 min
1 km
A trip to simulate an unconfirmed or a confirmed crash.
tripWithCrashStillDriving
23 min
24 km
A trip to simulate an accident confirmed less than two minutes after the start of the trip, after which the driver continued driving.
To verify if you are embedding the no-op module, you can call the following code:
To simulate a trip, you just need to send the selected trip to the start
method:
To stop the simulation of a trip, you need to call the stop
method:
The simulation of a trip with a collision only works on a real device, not with the simulator.
In order to mock a crash to check your integration, you must call the startCrashTrip
function with a PresetCrashConfiguration
item as parameter. Possible values for PresetCrashConfiguration enumeration are described in the table below:
confirmed30KmH
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.
confirmed20KmH
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.
confirmed10KmH
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.
unconfirmed0KmH
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.
confirmed30KmHStillDriving
A trip to with a collision at 30km/h that occures 95 seconds after the trip begins and that corresponds to a confirmed accident, after which the driver continue driving.
Location sharing while driving provides peace of mind to family members. The graphical interface helps the user to enable location sharing and create a link that displays his location on a map to a friend or family member while driving.
The feature is implemented across three distinct screens:
Introduction Screen: The feature is disabled by default. The first screen explains the location-sharing principle.
Duration Selection Screen: On the second screen, the user can choose the duration for sharing his trip location. The available options include one day, one week, or one month.
Active Sharing Screen: The last screen confirms that location sharing is active. It includes a button that allows the user to generate and share a link displaying his real-time location. Additionally, it displays the remaining time before the link expires.
To integrate and display this feature within your application, invoke the following method:
TripResult
is a sealed class that indicates if the analyzed trip by the DriveQuant servers is valid or not, and it either provides information about the analyzed trip, or the cause of the error:
If TripResult
is TripValid
, it means that the analyzed trip is valid. Additional information are available:
itinId
String
Unique trip identifier generated after the trip data analysis.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
hasSafetyAndEcoDrivingScore
Boolean
If false
, it means that the trip is too short to be analyzed.
In this case, there is no safety or ecodriving score.
info
The DriveQuant servers returns a list of information codes. These are not errors.
This object also provides a method, getTrip()
, to retrieve from the local database the saved Trip.
ENGINE_SPEED_NOT_AVAILABLE
The engine speed is not available. The trip analysis is performed with an estimated value of the engine speed.
ENGINE_SPEED_IS_NULL
The engine speed is always at 0 rpm while the vehicle is moving. The trip analysis is performed but with an estimated value of the engine speed.
NO_VEHICLE_CHARACTERISTICS
The vehicle characteristics are not set or some values are missing. The trip analysis is performed with generic vehicle model parameters.
DATA_LOSS
More than 25% of data loss is detected during the trip.
DISTANCE_TOO_SHORT
The trip was analysed but the distance is not sufficient to provide an accurate energy analysis.
INVALID_VEHICLE_CHARACTERISTICS
The vehicle characteristics are not in the range of available values. See vehicle characteristics for range limits.
INVALID_VEHICLE_ID
No vehicle found for the vehicleId
provided to the API request.
If TripResult
is TripError
, it means that the trip has been analyzed but an error occurred and data is not valid. Additional error information are available:
localTripId
String
Local and unique trip identifier generated by DriveKit SDK.
tripResponseError
TripResponseError
The reason why the trip is analyzed as invalid.
NO_ACCOUNT_SET
The account
block is not set in the trip data.
NO_ROUTE_OBJECT_FOUND
The route
block is not available in the trip data.
INVALID_ROUTE_DEFINITION
Error when parsing the route
block
NO_VELOCITY_DATA
The vehicle or GPS velocity is not available
INVALID_SAMPLING_PERIOD
The input variables have an invalid acquisition period.
INVALID_CUSTOMER_ID
Unknown account
value. Unauthorised access.
NO_DATE_FOUND
The field vehicleDate
or gpsDate
is not available.
MAX_DAILY_REQUEST_NUMBER_REACHED
The trip could not be analyzed because you exceeded your daily request quota.
DATA_ERROR
The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem.
INVALID_ROUTE_VECTORS
The route
vectors are not of the same size, the service cannot perform the analysis
MISSING_BEACON
The beacon has not been detected and it is required to validate the trip analysis.
INVALID_BEACON
A beacon was detected during the trip but it does not have the correct identifiers
DUPLICATE_TRIP
The duplicate trip feature is enabled and the trip has already been analysed
INSUFFICIENT_GPS_DATA
The number of GPS points is too low
USER_DISABLED
The driver is disabled, the service cannot perform the analysis
INVALID_USER
The user identifier is not valid.
INVALID_GPS_DATA
The dates are inconstistent, the service cannot perform the analysis
INVALID_TRIP
The trip has already been analysed by the service and considered as invalid
ACCOUNT_LIMIT_REACHED
The maximum number of user account reached for the customer
UNKNOWN_ERROR
The error is not yet handled by the DriveKit SDK.
itinId
String
Trip unique identifier.
endDate
Date
The end date of the trip.
startDate
Date?
The start date of the trip.
vehicleId
String?
The identifier of the vehicle used for this trip, if known.
transportationMode
TransportationMode
The transportation mode used for this trip, among: CAR
, MOTO
, TRUCK
, BUS
, TRAIN
, BOAT
, BIKE
, FLIGHT
, SKIING
, ON_FOOT
, IDLE
, OTHER
, UNKNOWN
.
declaredTransportationMode
DeclaredTransportationMode?
departureCity
String
The city of the departure of the trip.
arrivalCity
String
The city of the arrival of the trip.
departureAddress
String
The full address of the departure of the trip.
arrivalAddress
String
The full address of the arrival of the trip.
unscored
Boolean
true
if has no safety and eco-driving score.
metaData
Map<String, String>
tripStatistics
TripStatistics?
brakeWear
BrakeWear?
tireWear
TireWear?
ecoDriving
EcoDriving?
ecoDrivingContexts
List<EcoDrivingContext>
fuelEstimation
FuelEstimation?
fuelEstimationDrivingContexts
List<FuelEstimationDrivingContext>
safety
Safety?
safetyContexts
List<SafetyContext>
safetyEvents
List<SafetyEvent>?
driverDistraction
DriverDistraction?
pollutants
Pollutants?
speedingStatistics
SpeedingStatistics?
speedLimitContexts
List<SpeedLimitContext>?
calls
List<Call>?
energyEstimation
EnergyEstimation?
advancedEnergyEstimations
List<AdvancedEnergyEstimation>?
The user has the possibility to declare the transportation mode that was used during a trip to confirm the one detected or to change it, and to declare whether the trip was made as a passenger or as the driver.
Here is the description of the corresponding object:
transportationMode
TransportationMode
The transportation mode declared by the user for this trip, among: CAR
, MOTO
, TRUCK
, BUS
, TRAIN
, BOAT
, BIKE
, FLIGHT
, SKIING
, ON_FOOT
, IDLE
, OTHER
, UNKNOWN
.
passenger
Boolean?
true
if the trip was made as a passenger, false
if the trip was made as the driver.
comment
String?
The comment associated to this declaration.
This object is returned in the TripListener
's tripRecordingStarted()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
This object is returned in the TripListener
's tripRecordingConfirmed()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date
Date when the trip entered into the confirmation state.
This object is returned in the TripListener
's tripRecordingCanceled()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date?
Date when the trip was confirmed if the trip entered into the confirmation state.
cancelationReason
DKTripCancelationReason
Indicates how the trip was canceled.
This object is returned in the TripListener
's tripRecordingFinished()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date
Date when the trip entered into the confirmation state.
recordingEndDate
Date
StartMode
indicates how the trip is started. It is an enum with the following values:
Value
Description
GPS
Automatic start when the SDK detects a change in user position
BEACON
Automatic start due to the presence of a beacon
MANUAL
GEOZONE
Automatic start when the SDK detects that you exit the zone where your vehicle may be parked
BLUETOOTH
Automatic start by detecting a connection to a vehicle's Bluetooth system
UNKNOWN_BLUETOOTH
Automatic start by detecting a connection to a unknown vehicle's Bluetooth system
BICYCLE_ACTIVITY
Automatic start by detecting a bicycle activity
CONNECTED_CAR
Automatic start when the SDK detects that your smartphone has been connected to an Android Auto or Automotive OS system
USER
HIGH_SPEED
Trip canceled because speed was too high (train, airplane)
NO_SPEED
Trip canceled because speed was too slow to be made in a vehicle
NO_BEACON
NO_BLUETOOTH_DEVICE
MISSING_CONFIGURATION
Trip canceled because DriveKit was not configured
NO_LOCATION_DATA
Trip canceled because no location data was recorded
RESET
BEACON_NO_SPEED
Trip canceled because the beacon is near the smartphone but there was no movement (zero or low speed)
BLUETOOTH_DEVICE_NO_SPEED
Trip canceled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)
APP_KILLED
The trip recording has been canceled due to an app termination. The trip is not sent to the DriveQuant's platform for analysis because it has never entered in confirmation state, or the Bluetooth device/Beacon is required but has not been detected.
TripPoint is an object that contains data for each location registered by the SDK.
latitude
Double
Latitude
longitude
Double
Longitude
speed
Double
Speed in km/h
accuracy
Double
Accuracy of the GPS data in meter
elevation
Double
Elevation in meter
distance
Double
Distance since the beginning of the trip in meter
heading
Double
Heading
duration
Double
Duration since the beginning of the trip in second
TripVehicle is an object that contains vehicle detailed characteristics.
carTypeIndex
Int
1
carEngineIndex
Int
1
carPower
Double
150
carMass
Double
Vehicle mass in kg (min: 700 kg, max: 3500 kg)
1400
carGearboxIndex
Int
2
carConsumption
Double
Combined fuel consumption [l/100km] measured during the New European Driving Cycle (NEDC). (min: 3 l/100km, max: 20 l/100km)
4.5
carAutoGearboxNumber
Int
Number of gear ratios for the automatic gearbox. This parameter is taken into account only if carGearboxIndex
is set to 1.
6
engineDisplacement
Double
Engine displacement in liters
1200
frontTireSize
String?
Front tire size
"205/55/16"
rearTireSize
String?
Rear tire size
"205/55/16"
length
Double?
Vehicle length in meter
4.5
width
Double?
Vehicle width in meter
1.8
height
Double?
Vehicle height in meter
1.45
engineCylinderNb
Int?
Number of cylinders
4
driveWheels
Int?
0
BeaconData is an object that contains beacon characteristics.
proximityUuid
String
Beacon proximity UUID
major
Int
Beacon major value (set to -1 to ignore value)
minor
Int
Beacon minor value (set to -1 to ignore value)
BluetoothData is an object that contains the Bluetooth device characteristics.
macAddress
String
Required MAC address of the device
name
String
Optional display name of the device
Crash information object have the following structure:
crashId
String
Crash unique identifier
date
Date
Crash date
Example: 2023-03-07T09:13:22.461+0200
probability
Short
Crash probability (in %)
latitude
Double
Coordinates (latitude) of the crash
longitude
Double
Coordinates (longitude) of the crash
velocity
Double
Velocity at time of crash
crashStatus
DKCrashStatus
Crash status enum. Two possible values: CONFIRMED
or UNCONFIRMED
userLocationUrl
String?
Otherwise, it is null
.
DKCrashFeedbackConfig
is an object used to configure the Crash Detection feedback feature.
notification
DKCrashFeedbackNotification
Configuration of the notification
crashVelocityThreshold
Double
Minimal speed when the crash occurred.
For example, if crashVelocityThreshold
is set at 20 km/h and a crash occurred at 10 km/h, feedback will not be sent to the user.
Default value : 0.0 km/h
icon
Int
Resource identifier of the notification icon
channelId
String
Android channel identifier.
Default value: dq_sdk_crash_channel
notificationId
Int
Android notification identifier
title
String
Title that appears on the notification
message
String
Message that appears on the notification
activity
Class<*>
Activity to display
crashAlert
DKCrashAlert
Object that describes how the user will be noticed when a feedback is asked Default value : SILENCE
SILENCE
Device will not vibrate or ring
VIBRATION
Device will vibrate
SOUND_AND_VIBRATION
Device will ring and vibrate
NO_CRASH
User said that no crash occurred
CRASH_CONFIRMED
User confirmed a crash
NO_FEEDBACK
User did not provide any feedback
NONE
User said that no crash occurred
MINOR
User confirmed a minor crash
CRITICAL
User confirmed a critical crash
TripResponseStatus
is a sealed class that indicates if the analyzed trip by the DriveQuant servers is valid or not:
If TripResponseStatus
is TripValid
, it means that the analyzed trip is valid. Additional information are available:
hasSafetyAndEcoDrivingScore
Boolean
If false
, it means that the trip is too short to be analyzed.
In this case, there is no safety or ecodriving score.
info
The DriveQuant servers returns a list of information codes. These are not errors.
If TripResponseStatus
is TripResponseError
, it means that the trip has been analyzed but an error occurred and data is not valid. Additional error information are available in the tripResponseError
enum.
CancelTrip indicates how the trip was cancelled. It is an enum with the following values:
USER
HIGHSPEED
Trip cancelled because speed was too high (train, airplane)
NO_SPEED
Trip cancelled because speed was too slow to be made in a vehicle
NO_BEACON
MISSING_CONFIGURATION
Trip cancelled because DriveKit was not configured
NO_GPS_DATA
Trip cancelled because no GPS data was recorded
RESET
BEACON_NO_SPEED
Trip cancelled because the beacon is near the smartphone but there was no movement (zero or low speed)
BLUETOOTH_DEVICE_NO_SPEED
Trip cancelled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)
DeviceConfigEvent
indicates when the device configuration has been changed. It is a sealed class with the following values:
This data class is called when the Bluetooth device sensor has been turned on or off.
btEnabled
: Equals true
when the Bluetooth sensor has been turned on.
btRequired
: Equals true
when the DriveKit configuration needs the Bluetooth sensor (when beaconRequired
is set to true
or when TripAnalysis component is configured with is at least one beacon or one Bluetooth device).
This data class is called when the GPS sensor has been turned on or off
isEnabled
: Equals true when the GPS sensors has been turned on.
The Permissions Utils UI SDK is available on Cocoapods master repo.
To access the framework in the repository, add the following lines to your Podfile:
Then, run pod install
Then, to initialize the Permissions Utils module in your app, you must call the initialization method in didFinishLaunchingWithOptions method of your AppDelegate:
To automatically record a trip when the application runs in background, the DriveKit SDK must be allowed to access the phone's sensors.
Access to this data is allowed by iOS and Android under certain conditions. It is essential to inform the user and ask him to grant the required permissions to allow the application to access the data measured by the smartphone's sensors.
To help you collect consent from your users, the DriveKit SDK provides a graphical component, Permissions Utils, which displays the appropriate requests after the installation of the application.
The Permissions Utils component also contains a diagnosis functionality that alerts the user if the smartphone settings are not properly set up and guides the user to solve the detected issue.
To add the Permissions Utils UI module to your app, add the following line to your dependencies in your application build.gradle file:
Then, to initialize the module in your app, you must call the initialization method in onCreate
method of your Application class:
⚠️ It is different from the itinId
property returned in the object.
List<
>
⚠️ It is different from the itinId
property returned in the object. itinId
corresponds to the unique trip identifier generated after the data analysis.
The transportation mode declared by the user. See .
Your specific data attached to the trip. See .
Indicators that characterize the trip conditions. See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
Possible values are described .
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the trip start date returned in after DriveQuant platform's analysis.
Date when DriveKit has terminated the trip recording. ⚠️ It is not the trip end date returned in after DriveQuant platform's analysis.
Trip started manually by calling the method
Trip canceled by calling the method
Trip canceled because the beacon was not detected while it was
Trip canceled because the Bluetooth device was not detected while it was .
Trip canceled because SDK configuration has been .
Vehicle power in hp. This value must be entered in horsepower. In case you only have the engine power in kW you can apply the following formula: (min: 40 hp, max 450 hp)
When a crash is confirmed and is activated, an URL of the map that will display the location data is returned.
List<>
Trip cancelled by calling the method
Trip cancelled because the beacon was not detected while it was
Trip cancelled because SDK configuration has been .
Before starting DriveKit Permissions Utils UI integration, make sure that you have initialized module, especially if you have .
On a Github repository, you can find a demo app (for and ) and the source code of Permissions Utils UI that you can use as an example.
If you have , the Permissions Utils UI module must also be manually initialized. In the application's AppDelegate file, import DriveKitPermissionsUtilsUI:
We recommend you to test this component in the before you integrate it in your application.
Before starting DriveKit Permissions Utils UI integration, make sure that you have initialized module, especially if you have .
On a, you can find a demo app and the source code of Permissions Utils UI that you can use as an example.
If you have , the Permissions Utils UI module must also be manually initialized.
This section describes the main response codes of the trip analysis API.
1
Car
Compact
2
Car
Sedan
3
Car
Luxury vehicle
4
Car
Estate car
5
Car
Minivan
6
Car
4x4, SUV
7
Car
Sports car
8
Car
Convertible
9
Car
Commercial vehicle
200
Truck
2-axle trailer
201
Truck
3-axle trailer
202
Truck
4-axle trailer
203
Truck
2-axle tractor
204
Truck
3-axle tractor
1
Gasoline
2
Diesel
3
Electric vehicle
4
Gasoline-electric hybrid
5
Diesel-electric hybrid
6
Biofuel
7
Bi-fuel gasoline bioethanol
8
Dual-fuel gasoline NGV
9
Dual-fuel gasoline LPG
10
Not available
11
Plug-in gasoline hybrid
12
Hydrogen
1
Automatic
2
Manual 5-speed
3
Manual 6-speed
4
Manual 7-speed
5
Manual 8-speed
0
Front-wheel drive
1
Rear-wheel drive
2
Four-wheel drive
0
Unknown
1
Clear sky
2
Cloudy
3
Foggy
4
Rainy
5
Snowy
6
Icy
0
Unknown
1
Passenger car
2
Motorcycle
3
Heavy-duty vehicle
4
Bus
5
Coach
6
Rail trip
7
Boat trip
8
Bike trip
9
Plane
10
Ski
11
On foot
12
Idle
13
Other
0
Traffic jam
This corresponds to vehicle displacements of less than 100 meters and performed with speeds below 10 km/h
1
Heavy urban traffic
Speed below 30 km/h and distance between two stops greater than 100 m
2
City
30 km/h < Speed < 65 km/h
3
Suburban
65 km/h < Speed < 96 km/h
4
Expressways
Speed > 96 km/h
true
0
OK
The data are correct and the process ran fine
false
10
Mandatory account object not found
The « account» block is not set
false
13
Mandatory route object not found
The « route » block is not available → The trip analysis is not possible
false
14
Invalid route definition
Error when parsing the Route block
false
15
Velocity data is missing
The vehicle or GPS velocity is not available → The trip analysis is not possible
true
16
Engine speed not available
The engine speed is not available → The trip analysis is performed with an estimated value of the engine speed
true
17
Engine speed is null
The engine speed is always at 0 rpm while the vehicle is moving → The trip analysis is performed but with an estimated value of the engine speed
true
18
One or more vehicle parameters are missing (<list of missing parameters>). Default values are used
The vehicle characteristics are not set or some values are missing → The trip analysis is performed with generic vehicle model parameters
false
19
Invalid sampling period: one second recording interval is recommended for input variables
The input variables have an invalid acquisition period → The trip analysis is not possible
true
20
More than 25% of data loss
More than 25% of data loss is detected during the trip
false
21
Invalid customerId
Unknown account value. Unauthorized access.
false
23
Date data is missing
The field vehicleDate or gpsDate is not available → The trip analysis is not possible
false
24
Daily request number is reached
The maximum daily request number is reached
true
25
The trip distance is lower than 1 km
This error message indicates that the trip was analysed but the distance is not sufficient to provide an accurate energy analysis
false
26
Your request could not be processed. If the problem persist, please contact us
The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem
false
27
Your request could not be processed. If the problem persist, please contact us
The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem
true
28
One or more vehicle parameters are out of bound (<list of missing parameters>)
The vehicle characteristics are not in the range of available values. See vehicle characteristics for range limits
false
29
Beacon is missing
The beacon has not been detected and it is required to validate the trip analysis
false
30
Invalid beacon data
A beacon was detected during the trip but it does not have the correct identifiers
false
31
A similar trip has already been processed and stored with same account
The duplicate trip feature is enabled and the trip has already been analyzed
true
32
The vehicleId is invalid
No vehicle found for the vehicleId provided into the API request
false
33
The total of GPS points are under 10
There is not enough GPS points to perform an analysis
false
34
The account of this driver is disabled
The driver account is disabled
false
35
The automatic driver account creation is disabled
The automatic creation is disabled, use a valid authentication process to create the driver account
false
36
All the dates are negatives
The field vehicleDate or gpsDate contains negative values → The trip analysis is not possible
false
37
Your request could not be processed. If the problem persist, please contact us
The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem
false
38
Unable to create a new driver: maximum number of drivers reached for the account
The trip's driver cannot be created automatically, because you reached the maximum allowed number of drivers for your account. Please contact us to increase this threshold.
DriveKit Common UI includes configuration options and resources that are shared by all DriveKit UI modules. It allows to configure the colors and fonts of all DriveKit UI modules.
If you use the DriveKit graphical libraries, it is mandatory to set the configurations with the Common UI module.
DriveKit Common UI has several benefits:
it includes reusable components,
it simplifies the standardization of all layouts,
it avoids code duplicates.
On iOS, the user must grant access permission to the phone's location in background to enable the trip detection function included in the Trip Analysis component. There are several options for this permission and automatic mode will only work if the user selects the "Always" option.
The Permissions Utils component provides a set of screens to guide the user through the selection of the right options. Once the user has correctly authorized access to the location, you are warned by the closure passed in parameter:
It is also recommended that the user allows access to activity recognition (aka "Motion and fitness"). The Permissions Utils component contains a dedicated screen to help the user:
The method below helps you to configure the required permission requests and the order in which they are displayed. You will be notified when the requested permissions are successfully granted:
The diagnosis screen is divided into three areas:
The first displays the status of sensors and permissions.
The second contains a quick link to the battery optimization functions.
The third displays a contact button to reach support.
The first two areas are always displayed. The third is optional.
The diagnosis function of the SDK has the following configurations:
In area 1, the sensors and permissions to be checked are selected automatically except for the Bluetooth sensor. If your application does not use a Bluetooth device or an iBeacon, it is not necessary to monitor the status of the Bluetooth sensor.
Area 2 is always displayed. If battery optimization is enabled, a link will appear to redirect the user to the phone settings. The user will have to open the battery settings to disable the optimization.
In area 3, it is possible to configure the recipient's email address for the support request or a web address to which the user can be directed.
Access to the Bluetooth sensor is not required on iOS. This permission is not requested when the application is first installed.
For natural triggering (i.e. from the phone's sensors), or using an iBeacon, Bluetooth access is not required.
Access to the Bluetooth sensor is required in the two cases described below:
To enable automatic start of trip recording from a Bluetooth device.
To measure the battery level of an iBeacon device.
The user can make a support request if the application does not work properly.
When the user clicks on the support request button, you can choose between two actions:
An email will be automatically composed,
or a redirection to a web page of your choice will be made.
The email contains the key information to ease the diagnosis of a problem (status of permissions and phone sensors). The recipient's email is configurable, as well as other parameters:
If you don’t want the email body to contain information about the state of permissions and sensors, then return “true” in the method “overrideMailBodyContent()”.
If you want to redirect the user to a web page instead of composing an email, you have to add the following line:
In this specific case, there is no way to obtain information about authorization and sensor status.
If you do not configure the contact type, this area will be hidden and will not appear on the diagnosis screen.
This section describes the trip analysis API.
The overall approach behind DriveQuant’s trip analysis service is based on vehicle dynamics and powertrain modeling. Using vehicle or smartphone sensors, our services estimate the efforts applied to the powertrain enabling us, for example, to remodel the efforts between the road and the wheels or to estimate the exhaust pollutants.
DriveQuant’s data analysis service delivers a wide range of indicators describing vehicle usage and driver behavior. For a single trip, DriveQuant’s trip analysis service retrieves:
eco-driving indicators,
an estimate of the fuel consumption,
safety indicators,
tire and brake wear measurements,
pollutant emissions estimation,
a distraction score (phone use),
and a speed limit score.
The trip analysis API is automatically requested by the DriveKit SDK at the end of each trip.
This API can also be used without the DriveKit SDK if you have your own GPS data collection system (OBD dongle, black box, vehicle data).
This section explains how to query the trip analysis API, how driving indicators are computed and how they are structured.
POST
https://service.drivequant.com/v2/trip
This method returns all driving analytics calculated by DriveQuant for a trip.
DriveQuant counts the number of active assets per customer. The DriveQuant API is a pay-per-active-asset API. An asset is considered active if it has performed at least one trip on a monthly basis. An asset can be a driver (identified with its driverId) or a vehicle (identified by a vehicleId).
Three main use cases can be considered:
The request includes only a driverId: This is common when the data collected comes from a mobile application installed on a driver's phone. The total number of assets per customer is equal to the number of unique driverId's.
The request includes only a vehicleId: This is common when the data collected comes from a telematics device plugged into the vehicle. The total number of assets per customer is equal to the number of unique vehicleId's.
The Account object must contain the account and the userId or vehicleId attributes.
A request must contain all the data corresponding to a single trip. The trip data analysis cannot be cut into multiple queries. It is not recommended to merge data from several trips into a single request.
Route object must contain at least the vehDate or gpsDate and at least gpsVelocity or vehVelocity attributes.
The input variables included into Route object are arrays which must contain the same number of data points.
Some parameters have a default value if not set, and a min and max limitations:
Itinerary object is optional.
Metadata can be used if you want to add some of your specific data in a trip. They can be added to the Trip API as a key/value object where the key and value have a String type
The table below summarizes the list of driving data analysis modules. The comments and itinerary statistics modules are included by default. All other modules are optional and can be combined as needed.
Itinerary Statistics module provides several indicators that characterize the trip conditions: the trip distance, the vehicle movement duration and the idle duration. We also compute the number of sub-displacements. A trip can be characterized as a succession of events either dictated by the driver’s will or by external factors. These events, called breakpoints, are indicated with black dots in the figure below. Each section of a trip between two breakpoints is called sub-displacement. The figure illustrates these concepts for a short trip with one traffic light (vehicle stopped) and one intersection with priority (vehicle deceleration followed by acceleration).
Eco-driving module performs an analysis of the entire trip, characterized by a succession of events and road segments. The driving efficiency is computed by comparing the vehicle speed recorded with an optimal speed profile, for each segment. This calculation takes into account the actual driving conditions and a physical vehicle model that captures the inertial dynamics of the vehicle and the efficiency of the powertrain components. The eco-driving score ranges from 0 and 10, and is calculated by comparing the actual energy consumed during the trip with the energy that would have been consumed using the optimal speed profile. The best eco-driving score corresponds to the highest driving efficiency.
Acceleration, deceleration and speed maintain phases have a large impact on the vehicle’s fuel consumption. As a consequence, by comparing the real and the optimal speed profiles, eco-driving analysis module returns 3 key driving indicators.
The acceleration and deceleration scores range from -5 to +5. For a value of (-5), your acceleration or deceleration is too slow. For the highest value (+5) you are accelerating or decelerating too fast. A score of (0) indicates that your acceleration or deceleration perfectly matches with an eco-driving style.
The speed maintain score ranges from 0 to 5. The minimum value (0) indicates that the driver has an appropriate behavior and drives at a constant speed. On the other hand, if the driving analysis module detects an oscillating speed profile, this score increases. The highest value (+5) indicates that you can improve to keep a constant speed to reduce your fuel consumption.
These indicators will help you improve your driving efficiency and reduce your energy consumption. They can also illustrate the level of anticipation that the drivers should adopt to avoid harsh accelerations and brakings.
The numerical values of driving scores can be transformed into driving tips. The tables below give examples of content that can be returned to a driver based on the driving notes of a trip:
The eco-driving analysis is performed for vehicle displacement greater than 100 meters and speed higher than 10 km/h. This avoids providing inaccurate driving scores during vehicle maneuvers (slow driving in traffic jams or in parking lots...). In that case, eco-driving analysis module returns the following error codes:
11 for the eco-driving score
6 for acceleration phase, stabilized speed phase and deceleration phase
The energy class « energyClass » depends on the average fuel consumption of the vehicle. It positions the trip fuel consumption with respect to the average consumption of the vehicle.
In order to provide fair scoring and to facilitate drivers comparison, the trip scores can be accompanied by road class scores. These scores are included in the EcoDrivingContext class into the Advanced Modules. This service differentiates 5 types of road conditions (contextId) to contextualize the driving scores:
0 - Traffic jam: This corresponds to vehicle displacements of less than 100 meters and performed with speeds below 10 km/h. In traffic jams, it is obviously not possible to improve your driving, that is why scoring are not provided for this type of road.
1 - Heavy urban traffic
2 - City
3 - Suburban
4 - Expressways
In case a road type is not included in the trip, the distance and duration percentages are equal to zero, the efficiency score is set to 11 and the driving scores (Accel/Main/Decel) are set to 6.
The fuel consumption is obtained from a backward computation based on a mathematical modeling of the vehicle and powertrain. Fuel consumption estimation asseses the mechanical traction power from the vehicle speed and mass. A power transfer is performed between each component of the powertrain to compute the engine torque. Finally, the engine torque combined with the vehicle speed help to process the fuel mass from an engine consumption map developed by IFPEN. This fuel mapping is adapted according to the vehicle parameters and is valid for any type of vehicle or fleet of vehicles.
This approach is particularly adapted to estimate real-driving fuel consumption which can be more than 20% above the homologation data provided by car manufacturers. The main advantage lies in the accuracy of the estimate that can reach 5% when all input variables are available and the vehicle parameters set. The estimation method accounts for the physical fuel characteristics. These parameters are listed below:
Values calculated by fuel estimation module are described below:
In order to provide detailed fuel consumption estimation across the vehicle trips, the advanced fuel estimation service may return the fuel consumption for each driving context of the vehicle. This service differentiates 5 types of road conditions (contextId):
0 - Traffic jam
1 - Heavy urban traffic
2 - City
3 - Suburban
4 - Expressways
In case a road type is not included in the trip, the percentages of distance and duration are equals to zero as well as the co2Mass, co2Emission, fuelVolume and fuelConsumption.
For electric vehicles, DriveQuant provides energy information instead of fuel estimation.
To provide more details on the energy consumption, the service may return the energy data for each driving context of the vehicle.
If trip is too short to be scored, safetyScore
is set to 11.
In case a road type is no included in the trip, the distance and duration percentages are equal to zero and the safety score is set to 11.
The data provided in the following table helps to display safety events on your map system and deliver the locations of harsh braking or acceleration as well as the coordinates where a tire to road adherence threshold has been crossed.
The service provides the time, coordinate and severity level of each event. Two levels of severity are calculated using specific threshold values for each event.
The wear analysis service has been designed to monitor the brake pads and tires wear levels. This service was designed to improve vehicle maintenance solutions and can be used to create maintenance alerts.
The wear estimation relates to the power dissipated in the tire - road or brake disc - brake contact. To compute this variable our service relies on the vehicle’s dynamic modelling that estimates the braking efforts and the efforts at the contact between the tire and the road.
For each trip, the service gives for each components (front/rear brakes/tires):
The worn mass fraction during the trip.
The total worn percentage since the installation of new tires or brakes.
Tire and brake wear indicators for a single trip
The wear analysis service measures tire wear and brake pad wear. The service allows to distinguish the front and rear axles of the vehicle. The wear is assumed to be the same for the right tire and the left tire of the vehicle. A similar assumption is made for the brake pads.
The output value corresponds to a mass fraction of the worn component (tire or brake pad). This value is expressed in thousandth part of parts-per-million (ppm) which is a unit equivalent to a parts-per-billion (ppb).
The worn mass fraction (tire or brake pad) is given for each individual trip. To obtain the total worn mass fraction, the sum of all the trip’s values must be done. The total worn mass fraction value is bounded between a minimum and a maximum value:
Minimum value = 0 ppb. If the total worn mass fraction is 0, the component (tire or brake pad) is assumed to have no wear.
The wear calculation service estimates for each trip:
The worn fraction of front tires
The worn fraction of the rear tire
The worn fraction of the front brakes
The worn fraction of the rear brakes.
Example of tire autonomy calculation:
where ω is the tire worn mass fraction for the trip i (in ppb) and di is the distance (in km) of the trip i. The wear function f(ω) is a decreasing function that goes from infinity to zero. When f(ω) equals zero, the tire has no longer autonomy and must be replaced. This function is displayed below:
Total tire and brake wear indicators
In order to facilitate the integration within a vehicle maintenance service, the DriveQuant API provides for all your requests the following set of data related to any component (tires or brakes):
The total distance traveled with a given component (Distance)
The level of wear of the considered component (TotalWear)
The remaining autonomy before a complete wear (Autonomy)
The average wear speed of the considered component (WearRate)
The total autonomy of the considered component is assumed to be equal to the total travelled distance plus the remaining autonomy (Distance + Autonomy).
The diagram below illustrates the principle and the meaning of these quantities. The figure shows the evolution of the wear as a function of the distance traveled with the component. This is a generic representation that applies to a brake pad or a tire.
The autonomy of a set of tires or brakes is calculated for each axle (front and rear). For example, the most worn tire between the left tire and the right tire on the same axle is used.
The wear rate measures the component wear (in %) as a function of distance. This variable allows to compare vehicles and to inform a vehicle fleet manager whose components are wearing out too quickly. The wear rate is related to the type of vehicle, the driving style, the type of road used and the driving condition. This is why its value can change if the typology of trips changes and if the vehicle is driven by several drivers who have different driving styles.
Distracted driving becomes a serious problem and is becoming a major road safety issue.
That's why we've developed a service that measures the driver's interactions with his smartphone while driving. The objective is to increase driver awareness through a distraction score. This can be used to compare drivers, to classify them or to organize driving challenges.
The DriveKit SDK is capable of measuring the two main indicators of distracted driving:
screen unlocks,
and outgoing or incoming (and answered) phone calls.
The distraction score depends on 2 parameters :
the smartphone unlocking frequency;
the total duration of the call (or calls if there are several in the same trip).
Each parameter is giving a sub-score from 0 to 10. The distraction score is the minimum between these two sub-scores.
The sensitivity function linking the number of unlocks per 100 km to the unlock score is shown below.
The sensitivity function linking the call duration to the call score is shown below.
The response body includes the trip scores as well as detailed data related to unlocks and calls. This way you can better understand the score construction and provide clear explanations to the driver.
The data returned by the service are listed in the table below:
The Driver distraction score provides an array with all the calls answered or made by the driver. For each call, it contains information about its conditions.
The screenshot below shows how to display the phone use data on a mobile phone interface:
The distraction score service provides additional information related to screen unlock and screen lock events. Thus, it is possible to get the location of events related to phone use. These informations are useful if you need to display these data on your mapping system or if you want to perform advanced data analysis.
The table below lists all the data returned by the service:
Thanks to the distracted driving analysis service, you will be able to obtain contextualized and geolocalized data related to the detected events. This information is of great importance for the evaluation of the road risk and to help the driver to improve (by presenting this information on a map for example).
This service measures distance and driving time when the vehicle speed exceeds the speed limit.
From this information, a speed limit score is calculated. The speed limit score is 10 if the overspeed distance is zero. The speed limit score decreases with the increase in the percentage of distance spent in overspeeding.
The sensitivity function linking the relative speeding distance (in %) with the speeding score is shown below.
This service returns a global (or trip) score for the entire trip as well as several sub-scores corresponding to each of the legal speed portions traveled during the trip.
The global (or trip) score is the average of the sub-scores weighted by distance.
The service that computes the speeding score also returns location-based information about overspeeding events.
This type of information is used to indicate on a map the places on the trip where the speed of the vehicle exceeds the speed limit.
The start and end positions of overspeeding segments are included in the SpeedingEvents table.
Response body example
The Common UI SDK is a core configuration module for all DriveKit UI modules.
To add Common UI module to your app, add the following pod to your podfile:
Then, run pod install
This method will initialize the SDK with the default configuration set up by DriveQuant.
It is possible (from Swift, not Objective-C) to provide some parameters to this DriveKitUI initialization method in order to set custom values for colors (colors: DKColors
), fonts (fonts: DKFonts
), and/or text localization (overridedStringsFileName: String?
).
The colors that can be configured are listed in the table below:
To override the default colors configuration, you should create a subclass of DKDefaultColors
and override the colors that you want to change (or you can create an object implementing the DKColors
protocol, necessary if your project is in Objective-C for instance). Then pass an instance of this object as a parameter of the configureColors
method.
The Common UI configuration module allows to set up two fonts:
primaryFont
: this is the main font used in the application. The default value is Roboto.
secondaryFont
: this is the font used on the page titles or to emphasize a specific point. The default value is Roboto.
To override the fonts, you can add the primary and secondary fonts to the CommonUI SDK by calling the configureFonts
method as in this following example:
Note: From Objective-C, it is not possible to subclass the DKDefaultFonts
class. To override the fonts, it is thus necessary to create a class implementing the DKFonts
protocol.
Contents of each DriveKit UI module are translated into 7 languages: English, French, German, Spanish, Italian, Danish and Portuguese.
DriveKit simplifies the internationalization of your application and it is possible to add other languages.
DriveKit Common UI contains a number of basic text keys used in other DriveKit UI modules. You can override these keys to customize your application.
To help make the text keys in the code easier to read, a specific nomenclature has been set up: dk_<module name>_<key description>
.
For the Common UI module, all localizable keys are prefixed with: dk_common
.
There are several files containing text keys:
A .strings file in the common UI module containing generic keys to all modules.
One file per UI module containing module-specific text keys.
For analytics purposes, you can tag screens of any DriveKit UI component by providing to this following method an instance of an object conforming to DKAnalytics
protocol:
Where the Analytics object is for instance:
If, in the plist, a value is empty, the tracking is disabled for this screen.
The trackEvent
method allows you to add additional information that may be useful for analysis. For example, that method is called each time the user opens the trip detail screen.
On Android, the user must grant the SDK access to:
the phone's location and background activity monitoring to enable the trip detection function included in the Trip Analysis component;
the Nearby Devices permission to detect Bluetooth devices;
the background execution authorization to avoid the application being stopped by the power saving system.
Starting from Android 13, the user also needs to authorize the app to send notifications.
The Permissions Utils component provides a set of screens to guide the user through the selection of the right options.
Once all permissions have been granted by the user, you are warned by the closure passed in parameter:
The Permissions Utils component automatically manages the permission request workflow depending on the version of Android installed on the user's smartphone.
Each monitored setting has three levels of criticity defined by the enum PermissionStatus
: VALID
, NOT_VALID
and WARNING
.
VALID
: The setting is correctly configured (device sensor is ON and/or permission is authorized). There is no error and the trip analysis will work well.
NOT_VALID
: The setting is not correctly configured (device sensor is OFF and/or permission is declined). There is an error and the trip analysis will not work as expected.
WARNING
: The setting is not correctly configured, but it will not affect the trip analysis.
The diagnosis screen is divided into three areas:
The first displays the status of sensors and permissions.
The second contains a quick link to the battery optimization functions.
The third displays a contact button to reach support.
The first two areas are always displayed. The third is optional.
The diagnostic function of the SDK has the following configurations:
In area 1, the sensors and permissions to be checked are selected automatically except for the Bluetooth sensor. If your application does not use a Bluetooth device or an iBeacon, it is not necessary to monitor the status of the Bluetooth sensor.
In area 3, it is possible to configure the recipient's email address for the support request or a web address to which the user can be directed.
To use the app diagnosis display into your app, you must enter the following lines of code:
For natural triggering (i.e. from the phone's sensors), Bluetooth access is not required.
Access to the Bluetooth sensor is required in the two cases described below:
To enable automatic start of trip recording from an iBeacon device.
To enable automatic start of trip recording from a Bluetooth device.
If the Bluetooth sensor is turned off on the device, iBeacon and Bluetooth devices won't be detected.
Moreover, phone calls during a trip might not be detected and the distraction score can be affected.
The user can make a support request if the application does not work properly.
When the user clicks on the support request button, you can choose between two actions:
An email will be automatically composed,
or a redirection to a web page of your choice will be made.
The email contains the key information to ease the diagnosis of a problem (status of permissions and phone sensors). The recipient's email is configurable, as well as other parameters:
If you want to redirect the user to a web page instead of composing an email, you have to add the following line:
In this specific case, there is no way to obtain information about authorization and sensor status.
If you do not configure the contact type, this area will be hidden and will not appear on the diagnosis screen.
The Common UI module is a core configuration module for all DriveKit UI modules.
To add Common UI module to your app, add the following line to your dependencies in your application build.gradle file:
This method will initialize the SDK with the default configuration set up by DriveQuant.
The colors that can be configured are listed in the table below:
To override the default colors configuration, you just have to add the colors you want to change in the file res/values/colors.xml
in your app:
The Common UI configuration module allows to set up two fonts:
primaryFont
: this is the main font used in the application. The default value is Roboto.
secondaryFont
: this font is used on the page titles or to emphasize a specific point. The default value is Roboto.
To override the primary font, define your font family in the file res/font/dkprimary.xml
in your app:
To override the secondary font, define your font family in the file res/font/dksecondary.xml
in your app:
Contents of each DriveKit UI module are translated into 7 languages: English, French, German, Spanish, Italian, Danish and Portuguese.
DriveKit simplifies the internationalization of your application and it is possible to add other languages.
DriveKit Common UI contains a number of basic text keys used in other DriveKit UI modules. You can override these keys to customize your application.
To help make the text keys in the code easier to read, a specific nomenclature has been set up: dk_<module name>_<key description>
.
For the Common UI module, all localizable keys are prefixed with: dk_common
.
There are several files containing text keys:
A string.xml file in the common UI module containing generic keys to all modules.
One file per UI module containing module-specific text keys.
You can retrieve some data and build analytics for any DriveKit UI component. To enable the feature, call the following method:
trackScreen()
method is called when a screen is displayed (i.e. trips list, trip detail, etc.).
In order to customize screens values, you have to override keys you can find in dk_analytics.xml in each DriveKit UI component.
trackEvent()
allows adding additional information that may be useful for analysis. For example, that method is triggered each time the user is opening the trip detail screen.
The Driver Data component manages the download and display in your mobile application of all trips made by the user.
The Driver Data component continuously performs synchronization between the remote DriveQuant database and the local database of the mobile SDK.
The Driver Data component has been designed to simplify the integration of DriveQuant services into your application and to drastically reduce your development time.
It has several benefits:
The SDK contains its own database. You do not need to create a local database (or modify the existing one) to persist the user driving data.
Network calls are fully automated. You do not need to implement API requests for driver data recuperation.
The SDK includes a graphics library that displays the user's trip data. You do not need to develop new screens in your application. The trip analysis display screens are configurable and can be easily adapted to the style of your mobile application.
If you use Driver Data without having initialized DriveKit, the SDK may not work properly in your application.
The Driver Data SDK is available on Cocoapods master repo.
To access framework in the repository, add the following lines to your Podfile:
Then, run pod install
.
Then, to initialize Driver Data module in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate file.
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize local trips with DriveQuant backend to get new trips or modified trips, and then return the trip list via the completionHandler.
cache
: if this value is used, no synchronization will be performed and only trips previously synchronized will be returned via the completionHandler.
TripSyncStatus
in the completionHandler can have 4 values:
noError
: Synchronization has been successfully performed.
cacheDataOnly
: SynchronizationType has been set to cache
.
failedToSyncTripsCacheOnly
: Synchronization has failed, only trips previously synchronized are returned.
syncAlreadyInProgress
: A synchronization is in progress, only trips previously synchronized are returned until the synchronization is finished.
If train trips have been recorded by Trip Analysis SDK, they won't be returned by this method.
Example:
The itinId
parameter is the unique identifier for a trip.
When you call this method, you will get trip data and trip safety events. If safety events are not synchronized locally for the trip, a synchronization with DriveQuant backend will be performed and then, the trip will be returned with safety events synchronized.
Example:
To get road data of the trip (latitude, longitude), you have to call the following method:
If route
value in completionHandler is nil
, the synchronization has failed.
Example:
To delete a trip, you have to call the following method:
The itinId
parameter is the unique identifier for a trip.
Example:
To get driver synthesis data, you have to call the following method:
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize the driver synthesis data with DriveQuant backend and then return it via the completionHandler.
cache
: if this value is used, no synchronization will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
SynthesisSyncStatus
in the completionHandler can take 3 values:
cacheDataOnly
: SynchronizationType has been set to cache.
noError
: Synchronization has been successfully performed.
failedToSyncSynthesisCacheOnly
: Synchronization has failed, only data retrieved during the last synchronisation is returned.
Example:
periods
attribute contains periods you are interested in: .week
, .month
and/or .year
.
defaultSync
: if this value is used, the SDK will try to synchronize timelines with DriveQuant backend and then return them via the completionHandler.
cache
: if this value is used, no synchronization will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
cacheDataOnly
: SynchronizationType has been set to cache.
noError
: Synchronization has been successfully performed.
failedToSyncTimelineCacheOnly
: Synchronization has failed, only data retrieved during the last synchronisation are returned.
noTimelineYet
: Synchronization has been successfully performed and there is currently no timeline.
To get driver timelines, you have to call the following method:
TimelineSyncStatus
in the completionHandler
can take 4 values:
cacheDataOnly
: SynchronizationType
has been set to cache.
noError
: Synchronisation has been successfully performed.
failedToSyncTimelineCacheOnly
: Synchronisation has failed, only data retrieved during the last synchronisation are returned.
noTimelineYet
: Synchronisation has been successfully performed and there is currently no timeline.
Example:
To get driver profile, you have to call the following method:
SynchronizationType
can have 2 values:
defaultSync
: if this value is used, the SDK will try to synchronize the driver profile with DriveQuant backend and then return it via the completionHandler.
cache
: if this value is used, no synchronisation will be performed and the data retrieved during the last synchronisation will be returned via the completionHandler.
DKDriverProfileStatus
in the completionHandler can take 4 values:
success
: Synchronization type has been successfully performed.
failedToSyncDriverProfileCacheOnly
: Synchronisation has failed, only data retrieved during the last synchronisation is returned.
noDriverProfileYet
: Synchronisation has been successfully performed and there is currently no driver profile for this user.
forbiddenAccess
: Your team doesn’t have access to this data.
DriveQuant services provide additional data by collecting all vehicle trips so you can easily retrieve statistics for each of your vehicles. We recommend to before requesting the trip analysis API if you target a vehicule mantenance use case.
The request includes a driverId and a vehicleId: This is common when a group of drivers can use several vehicle within a fleet. The total number of assets may be the number of unique vehicleId's or driverId's. Billing and counting will depend on your business model and the difference between the number of drivers and vehicles. Please sales department to find out the best pricing model.
The sample period for all input vectors must be 1 second. The sampling frequency of 1Hz is a standard for GPS sensors. in case your telematics device does not satisfy this constraint, please to determine what alternative can be applied.
Possible values are described .
Class A corresponds to 0.5 x the NEDC consumption of the vehicle expressed in .
Class E corresponds to 1.5 x the NEDC consumption of the vehicle expressed in
Then we defined the 5 classes with a uniform distribution between class A and class E. The energy class « energyClass » is calculated from the trip emission « co2Emission » and the function below:
Maximum value = ppb. If the total worn mass fraction reaches the maximum value, this means that the component (tire or brake pad) is fully worn and must be replaced.
For a tire, the maximum value for the mass fraction (ppb) indicates that the tire has lost all its usable mass of rubber. This corresponds to a minimum tire tread height of 1.6 mm. In France, a tire must legally have a minimum tread height of 1.6 mm over its entire circumference.
Assuming a vehicle that has performed trips, the tire autonomy ( ) in km can be computed as follow:
with
On this, you have a demo app and source code that you can use as an example.
If you have , an initialization phase is required to ensure that Common UI module works perfectly. To initialize Common UI module in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate file.
To override a text key in the common UI module, simply define the keys to be modified in a .strings file at the application level and configure the filename in the common UI module. The text keys can be directly retrieved on , in the Localizable folder of each module.
The translation file can be retrieved from . Add it to your application after adding the appropriate translation(s).
The screen
String received in the trackScreen
method is the value associated to one of the keys, corresponding to the visited screen. If you want to customize screen tags, you can provide the path to a plist file (see the ) with your custom values in the configuration method:
Area 2 is always displayed if the Android version includes power-saving features (introduced from Android 6.0 - ).
On a, you have a demo app and source code that you can use as an example.
If you have , an initialization phase is required to ensure that Common UI module works perfectly. To initialize Common UI module in your app, you must call the initialization method in onCreate
method of your application class.
You can override any texts to customize your application. To override a text key, simply define the keys to be modified in a string.xml file at the application level. The text keys can be directly retrieved on , in the src/main/res/values folder of each module.
The translation file can be retrieved from in the various DriveKit UI modules and integrated into the values-<Locale> folder of the app.
When the method is called, you just have to call your analytics solution like Google Analytics for Firebase.
The screen
String received in the trackScreen
method is the value associated with one of the keys , corresponding to the visited screen.
The Driver Data component uses standard and powerful libraries recommended by Apple and Google for persistence management. On Android, the is implemented. On iOS, the persistence framework provided by Apple is used.
We recommend you to test this component in the before you integrate it in your application.
Before starting DriveKit Driver Data integration, make sure that you have .
If you have , an initialization phase is required to use the feature included in the Driver Data module. In the application's AppDelegate file, import DriveKitDriverData:
To get , you have to call the following method:
The second argument in the completionHandler
is the list of objects.
To get a specific , you have to call the following method:
TripSyncStatus
can have the same value as and the value failedToSyncSafetyEvents
if the safety events synchronization failed.
The second argument in the completionHandler
is the requested object, if exists.
The second argument in the completionHandler
is a list of object, one per period requested.
The second argument in the completionHandler is the object requested.
account
object
Identification data for the trip
route
object
GPS or vehicle recorded data for the trip
vehicle
object
Vehicle characteristics used for the trip
itineraryData
object
Data of the trip
metaData
object
Customer specific data
account
string
API key
userId
string
User unique identifier
vehicleId
string
Vehicle unique identifier
gpsVelocity
array[double]
GPS speed vector in km/h
latitude
array[double]
Latitude vector in degree
longitude
array[double]
Longitude vector in degree
gpsAccuracy
array[double]
GPS accuracy vector in meter
gpsElevation
array[double]
Elevation vector in meter
gpsHeading
array[double]
Heading vector in degree
gpsDate
array[double]
GPS timestamp vector in second
vehVelocity
array[double]
Vehicle speed vector in km/h
vehEngineSpeed
array[double]
Engine speed vector in rotation per minute
vehTankLevel
array[double]
Fuel tank volume in liter
vehWheelAngle
array[double]
Steering angle vector in degree
batteryVoltage
array[double]
Measurement of the car battery voltage vector in volt
vehDate
array[double]
Vehicle date timestamp vector in second
carTypeIndex
int
carEngineIndex
int
carPower
double
Vehicle power in hp. This value must be entered in horsepower. In case you only have the engine power in kW you can apply the following formula:
carMass
double
Vehicle mass in kg
carGearboxIndex
int
carConsumption
double
Combined fuel consumption [l/100km] measured during the New European Driving Cycle (NEDC)
carAutoGearboxNumber
int
Number of gear ratios for the automatic gearbox. This parameter is taken into account only if carGearboxIndex
is set to 1
carTypeIndex
1 (compact)
-
-
carEngineIndex
1 (gasoline)
-
-
carPower
150
40
450
carMass
1400
700
3500
carGearboxIndex
2 (manual 5-speed)
-
-
carConsumption
4.5
3
20
startDate
date
Trip start date
Date format: YYYY-MM-dd’T’HH:mm:ss.SSSZ
endDate
date
Trip end date
Date format: YYYY-MM-dd’T’HH:mm:ss.SSSZ
departureCity
string
Name of the departure city
arrivalCity
string
Name of the arrival city
itinId
string
Trip unique identifier
status
boolean
true
if no problem, false
otherwise
comments
array[object]
see Comment
itineraryStatistics
object
itineraryData
object
ecoDriving
object
advancedEcoDriving
object
fuelEstimation
object
advancedFuelEstimation
object
safety
object
advancedSafety
object
safetyEvents
array[object]
see SafetyEvent
tireWear
object
brakeWear
object
pollutants
object
userId
string
unique id of the user
firstname
string
first name of the user
lastname
string
Last name of the user
endDate
string
End date of the trip
driverDistraction
object
distractionEvents
array[object]
callEvents
array[object]
see CallEvent
speedingStatistics
object
speedingEvents
array[object]
see SpeedingEvents
energyEstimation
object
advancedEnergyEstimation
array[object]
errorCode
int
Error code
comment
string
Error description
distance
double
Distance travelled in meter
speedMean
double
Mean vehicle speed in km/h
tripDuration
double
Total trip duration in second
drivingDuration
double
Vehicle movement duration in second
idlingDuration
double
Total duration of idling phases (vehicle stopped)
in second
drivingPercentage
double
Percentage of vehicle movement
idlingPercentage
double
Percentage of idling phases
subdispNb
in
t
Number of sub-displacements detected during the trip
meteo
int
day
boolean
true
if day, false
if night
weekDay
boolean
true
: Monday to Friday, false
: Saturday to Sunday
transportationMode
int
startDate
date
Trip start date
Date format: YYYY-MM-dd’T’HH:mm:ss.SSSZ
endDate
date
Trip end date
Date format: YYYY-MM-dd’T’HH:mm:ss.SSSZ
departureCity
string
Name of the departure city
arrivalCity
string
Name of the arrival city
departureAddress
string
Departure full address
arrivalAddress
string
Arrival full address
score
double
Eco-driving score (min: 0, max: 10). If trip is too short to be scored, score is set to 11.
scoreAccel
double
Score of the acceleration phases. If trip is too short to be scored, score is set to 6.
scoreMain
double
Score of the stabilized speed phases. If trip is too short to be scored, score is set to 6.
scoreDecel
double
Score of the deceleration phases. If trip is too short to be scored, score is set to 6.
stdDevAccel
double
Standard deviation of acceleration score
stdDevMain
double
Standard deviation of stabilized speed score
stdDevDecel
double
Standard deviation of deceleration score
energyClass
int
See Energy Class:
0: energy class A
1: energy class B
2: energy class C
3: energy class D
4: energy class E
-5 to -4
Acceleration is too low
-4 to -2
Weak acceleration
-2 to 1
Good acceleration
1 to 3
Strong acceleration
3 to 5
Acceleration is too high
0 to 1.5
Good speed maintain
1.5 to 3.5
Irregular speed
3.5 to 5
Very fluctuating speed
-5 to -4
Deceleration is too low
-4 to -2
Weak deceleration
-2 to 1
Good deceleration
1 to 3
Strong deceleration
3 to 5
Deceleration is too high
ecoDrivingContext
array[object]
Array of EcoDrivingContext
distance
double
Percentage of distance travelled in a road type
duration
double
Percentage of elapsed time in a road type
efficiencyScore
double
Eco-driving score
scoreAccel
double
Score of the acceleration phases
scoreMain
double
Score of the stabilized speed phases
scoreDecel
double
Score of the deceleration phases
contextId
int
Gasoline
0.755
44
70.26
2.3340
Diesel
0.845
42
75.70
2.6866
co2Mass
double
Total Mass of in kg
co2Emission
double
Average Mass of per unit of distance in g/km
fuelConsumption
double
Average fuel consumption per unit of distance in l/100km
fuelVolume
double
Total fuel consumption in liter
idleFuelPercentage
double
Idle fuel consumption percentage
idleFuelConsumption
double
Idle fuel consumption per unit of time in l/h
idleCo2Emission
double
Idle emission in g/km
idleCo2Mass
double
Idle mass in kg
engineTempStatus
boolean
Engine cold start?
coldFuelVolume
double
Cold engine fuel volume
fuelEstimationContext
array[object]
Array of FuelEstimationContext
contextId
int
Road conditions
distance
double
Percentage of distance travelled in a road type
duration
double
Percentage of elapsed time in a road type
co2Mass
double
Total Mass of in kg
co2Emission
double
Average emissions in g/km
fuelVolume
double
Total fuel consumption in liter
fuelConsumption
double
Average fuel consumption in l/100km
energy
double
Estimated energy in kWh
energyConsumption
double
Estimated energy consumption in kWh/100km
energyOpti
double
Optimal energy in kWh
energyOptiConsumption
double
Optimal energy consumption in kWh/100km
energy
double
Estimated energy in kWh
energyConsumption
double
Estimated energy consumption in kWh/100km
energyOpti
double
Optimal energy in kWh
energyOptiConsumption
double
Optimal energy in kWh/100km
contextId
int
Road conditions
distance
double
Percentage of distance travelled in a road type
duration
double
Percentage of elapsed time in a road type
safetyScore
double
Driver risk index for a given itinerary
Ranges from 3 to 10
nbAdh
int
Number of adherence threshold crossing
nbAccel
int
Number of strong accelerations
nbDecel
int
Number of strong decelerations
nbAdhCrit
int
Number of adherence threshold crossing (critical)
nbAccelCrit
int
Number of critical accelerations (critical)
nbDecelCrit
int
Number of critical decelerations (critical)
safetyContext
array[object]
Array of SafetyContext
distance
double
Percentage of distance travelled in a road type
duration
double
Percentage of elapsed time in a road type
safetyScore
double
Ranges from 3 to 10
nbAdh
int
Number of adherence threshold crossing
nbAccel
int
Number of strong accelerations
nbDecel
int
Number of strong decelerations
nbAdhCrit
int
Number of adherence threshold crossing (critical)
nbAccelCrit
int
Number of critical accelerations (critical)
nbDecelCrit
int
Number of critical decelerations (critical)
contextId
int
Road conditions
time
double
Time since the beginning of the trip in second
latitude
double
Latitude in degree
longitude
double
Longitude in degree
velocity
double
Vehicle speed in km/h
heading
double
Vehicle heading in degree
elevation
double
Altitude in meter
distance
double
Distance travelled since the beginning of the trip in meter
type
int
Type of event 1. Adherence 2. Acceleration 3. Braking
level
int
Intensity related to the event 1. Strong 2. Harsh
value
int
Absolute value of the event:
in m/s2 for acceleration and braking events
normalized between 0 and 1 for the adherence events
Acceleration
m/s2
2.0
2.5
Braking
m/s2
-1.8
-2.4
Adherence limit
-
0.2
0.3
co
double
Carbon monoxide (CO) emissions expressed in mg/km
hc
double
Hydrocarbons (HC) emissions expressed in mg/km
nox
double
Nitrogen oxide emissions (NOx) expressed in mg/km
soot
double
Soot emissions expressed in mg/km
frontTireWear
int
Worn mass fraction of the front tires (right/ left) for current trip
Unit : thousandths part of ppm = ppb
Min. value = 0 / Max. value =
rearTireWear
int
Worn mass fraction of the rear tires (right/left) for current trip
Unit : thousandths part of ppm = ppb
Min. value = 0 / Max. value =
frontBrakePadWear
int
Worn mass fraction of the front brakes (right/left) for current trip
Unit : thousandths part of ppm = ppb
Min. value = 0 / Max. value =
rearBrakePadWear
int
Worn mass fraction of the rear brakes (right/left) for current trip
Unit : thousandths part of ppm = ppb
Min. value = 0 / Max. value =
frontTireDistance
int
Total distance analyzed for the front tires (in km)
Min. value = 0 / Max. value = 1 000 000
rearTireDistance
int
Total distance analyzed for the rear tires (in km)
Min. value = 0 / Max. value = 1 000 000
frontBrakeDistance
int
Total distance analyzed for the front brakes (in km)
Min. value = 0 / Max. value = 1 000 000
rearBrakeDistance
int
Total distance analyzed for the rear brakes (in km)
Min. value = 0 / Max. value = 1 000 000
frontTireAutonomy
int
Front tires remaining distance before change (in km)
Min. value = 0 / Max. value = 1 000 000
rearTireAutonomy
int
Rear tires remaining distance before change (in km)
Min. value = 0 / Max. value = 1 000 000
frontBrakeAutonomy
int
Front brakes remaining distance before change (in km)
Min. value = 0 / Max. value = 1 000 000
rearBrakeAutonomy
int
Rear brakes remaining distance before change (in km)
Min. value = 0 / Max. value = 1 000 000
frontTireTotalWear
double
Total worn mass percentage of the front tires (right/left)
Min. value = 0% / Max. value = 100%
rearTireTotalWear
double
Total worn mass percentage of the rear tires (right/left)
Min. value = 0% / Max. value = 100%
frontBrakeTotalWear
double
Total worn mass percentage of the front brakes (right/left)
Min. value = 0% / Max. value = 100%
rearBrakeTotalWear
double
Total worn mass percentage of the rear brakes (right/left)
Min. value = 0% / Max. value = 100%
frontTireWearRate
double
Average wear rate for the front tires (in %/1000 km )
rearTireWearRate
double
Average wear rate for the rear tires (in %/1000 km )
frontBrakeWearRate
double
Average wear rate for the rear brakes (in %/1000 km )
rearBrakeWearRate
double
Average wear rate for the rear brakes (in %/1000 km )
nbUnlock
int
Number of phone screen unlock events
nbLock
int
Number of phone screen lock events
distance
double
Relative distance traveled with the screen on (in %)
distanceM
double
Distance traveled with the screen on (in m)
duration
double
Relative duration traveled with the screen on (in %)
durationS
double
Duration traveled with the screen on (in s)
score
double
Phone distraction score (Min. value = 0, Max. value = 10)
scoreUnlock
double
Distraction sub-score which takes into account the number of locking/unlocking
scoreCall
double
Distraction sub-score which takes into account the number of calls during the trip
calls
array[object]
id
int
Unique identifier of the call
start
double
Seconds from beginning of the trip when call starts
end
double
Seconds from beginning of the trip when call ends
durationS
double
Duration traveled in call (in s)
duration
double
Relative duration traveled in call (in %)
distanceM
double
Distance traveled in call (in m)
distance
double
Relative distance traveled in call (in %)
status
string
INCOMING : incoming call
OUTGOING : outgoing call
UNKNOWN : unknown call status
audioSystem
string
Audio system used to make the call (SPEAKER, LOUDSPEAKER, A2DP, HANDSFREE, HEADPHONE, CAR_AUDIO, UNKNOWN)
forbidden
boolean
true
if the call is forbidden
false
if the call is authorized (made with handsfree)
time
double
Time since the beginning of the trip (in s)
latitude
double
Latitude (in deg)
longitude
double
Longitude (in deg)
velocity
double
Vehicle speed (in km/h)
heading
double
Vehicle heading (in deg)
elevation
double
Altitude (in m)
distance
double
Distance travelled since the beginning of the trip (in m)
type
int
Type of event : (1) Screen ON and (2) Screen OFF
time
double
Time in second since the beginning of the trip
latitude
double
Latitude in degree
longitude
double
Longitude in degree
velocity
double
Vehicle speed in km/h
heading
double
Vehicle heading in degree
elevation
double
Altitude in meter
distance
double
Distance travelled during the call in meter
type
int
3: Call start
4: Call end
duration
int
Call duration in seconds
index
int
Position of the beginning of the event in the route date (phone call beginning of phone unlocking)
audioSystem
string
Audio system used to make the call (SPEAKER
, LOUDSPEAKER
, A2DP
, HANDSFREE
, HEADPHONE
, CAR_AUDIO
, UNKNOWN
)
callType
string
Call type
Allowed values: INCOMING
, OUTGOING
, UNKNOWN
forbidden
boolean
true
if the call is forbidden
false
if the call is authorized (made with handsfree)
distance
int
trip distance (m)
duration
int
trip duration (s)
speedingDistance
int
Distance travelled at a speed above the limit (m)
speedingDuration
int
Duration spent at a speed above the limit (s)
score
double
Speeding score
speedLimitContexts
array[object]
Array of SpeedLimitContexts
speedLimit
int
Speed limit (in km/h) for the portion of the trip
distance
int
Total distance (in m) for the portion of the trip limited at the speed limit value
duration
int
Total duration (in s) for the portion of the trip limited at the speed limit value
speedingDistance
int
Distance travelled at a speed above the limit (in m) within the speed limit portion
speedingDuration
int
Duration spent at a speed above the limit (in s) within the speed limit portion
score
double
Speeding score for a given speed limit portion
time
double
Time in second since the beginning of the trip
latitude
double
Latitude in degree
longitude
double
Longitude in degree
type
int
1 = Overspeeding segment start point
0 = Overspeeding segment endpoint
index
int
Index of the speeding event in the matched route vector.
Name
Description
Default value
primaryColor
Main app color
#0B4D6E
secondaryColor
Call to action color
#77E2B0
mainFontColor
Main font color
#161616
complementaryFontColor
Secondary font color
#9E9E9E
fontColorOnPrimaryColor
Color of a text displayed on an element whose color is primaryColor
#FFFFFF
fontColorOnSecondaryColor
Color of a text displayed on an element whose color is secondaryColor
#FFFFFF
backgroundViewColor
Background color
#FAFAFA
neutralColor
Color of the separating lines
#F0F0F0
warningColor
Warning color (non-critical hint)
#F7A334
criticalColor
Alert color (critical hint)
#E52027
navBarElementColor
Color of elements (title and items) in the navigation bar
fontColorOnPrimaryColor
Screen key
Screen tag value
dk_tag_trips_list
drivekit-trips-list
dk_tag_trips_detail
drivekit-trips-detail
dk_tag_trips_detail_advice_safety
drivekit-trips-detail-advice-safety
dk_tag_trips_detail_advice_efficiency
drivekit-trips-detail-advice-efficiency
dk_tag_trips_detail_transportation_mode
drivekit-trips-detail-transportation_mode
dk_tag_badges
drivekit-badges
dk_tag_rankings
drivekit-rankings
dk_tag_streaks
drivekit-streaks
dk_tag_vehicles_list
drivekit-vehicles-list
dk_tag_vehicles_detail
drivekit-vehicles-detail
dk_tag_vehicles_add
drivekit-vehicles-add
dk_tag_vehicles_beacon_verify
drivekit-vehicles-beacon-verify
dk_tag_vehicles_beacon_add
drivekit-vehicles-beacon-add
dk_tag_vehicles_beacon_diagnosis
drivekit-vehicles-beacon-diagnosis
dk_tag_vehicles_beacon_info
drivekit-vehicles-beacon-info
dk_tag_vehicles_bluetooth_add
drivekit-vehicles-bluetooth-add
dk_tag_permissions_diagnosis
drivekit-permissions-diagnosis
dk_tag_permissions_onboarding
drivekit-permissions-onboarding
dk_tag_challenge_list_active
drivekit-challenge-list-active
dk_tag_challenge_list_finished
drivekit-challenge-list-finished
dk_tag_challenge_join
drivekit-challenge-join
dk_tag_challenge_detail
drivekit-challenge-detail
dk_tag_challenge_detail_results
drivekit-challenge-detail-results
dk_tag_challenge_detail_ranking
drivekit-challenge-detail-ranking
dk_tag_challenge_detail_trips
drivekit-challenge-detail-trips
dk_tag_challenge_detail_rules
drivekit-challenge-detail-rules
Name
Description
Default value
primaryColor
Main app color
#0B4D6E
secondaryColor
Call to action color
#77E2B0
mainFontColor
Main font color
#161616
complementaryFontColor
Secondary font color
#9E9E9E
fontColorOnPrimaryColor
Color of a text displayed on an element whose color is primaryColor
#FFFFFF
fontColorOnSecondaryColor
Color of a text displayed on an element whose color is secondaryColor
#FFFFFF
backgroundViewColor
Background color
#FAFAFA
neutralColor
Color of the separating lines
#F0F0F0
warningColor
Warning color (non-critical hint)
#F7A334
criticalColor
Alert color (critical hint)
#E52027
Before starting DriveKit Driver Data UI integration, make sure that you have initialized DriverData and Common UI components, especially if you have disabled the SDK auto-initialization.
The Driver Data UI SDK is available on Cocoapods master repo.
To access the framework in the repository, add the following lines to your Podfile:
Then, run pod install
.
If you have disabled the SDK auto-initialization, the Driver Data UI module must also be manually initialized. In the application's AppDelegate file, import DriveKitDriverDataUI
:
Then, to initialize Driver Data UI SDK in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate:
To override colors and texts in Driver Data UI SDK, see Common UI configuration.
It is possible to choose the main theme for the trip list. The main theme of the trip list is used to select the score to be displayed on the left side of the trip list. It is set by the TripData
enum. It has 6 possible values:
.safety
: The driving safety score.
.ecoDriving
: The eco-driving score.
.distraction
: The driving distraction score.
.distance
: The trip distance.
.duration
: The driving duration.
.speeding
: The speeding score.
The value .speeding
can be set only if this configuration is enabled for your API key.
The main theme is configured in the SDK initialize
method by setting the parameter tripData
.
The default value is safety
.
A trip is analyzed through several dimensions and DriveQuant's services provide multiple categories of scores. Depending on your need, you can highlight the scores of interest and hide some of them. The configuration of the trip detail screen allows to choose the displayed themes and the displaying order. To switch from one theme to another, simply swipe the bottom part of the screen or click on one of the pictograms in the navigation bar at the top of the screen.
The screens that can be displayed are listed below:
The safety analysis results: .safety
.
The eco-driving results: .ecoDriving
.
The distracted driving results: .distraction
.
The speeding driving results: .speeding
.
A scrollable list that displays all the events that occurred during the trip: .interactiveMap
.
Synthetic data of the trip as average speed, CO2 emissions, estimated fuel consumption, driving conditions : .synthesis
.
The value .speeding
can be set only if this configuration is activated on your team.
The main theme is configured in the SDK initialize
method by setting the parameter mapItems
.
The default value is:
[.safety, .ecoDriving, .distraction, .speeding, .interactiveMap, .synthesis]
To show view in your navigation controller, you just have to create an instance of TripListVC
and then push the view controller in your navigation controller.
TripResponseStatus
indicates if the analyzed trip by the DriveQuant servers is valid or not (see status
property) and provides information on the analysis result:
status
TripResponseStatusType
Can be tripValid
or tripError.
- tripValid
means that the analyzed trip is valid.
- tripError
means that the trip has been analyzed but an error occurred and data is not valid.
itinId
String?
The id of the trip if status
equals tripValid
, otherwise nil
.
localTripId
String?
Local and unique trip identifier generated by DriveKit SDK
hasSafetyAndEcoDrivingScore
Bool
If false
, it means that the trip is valid but too short to be analyzed.
In this case, there is no safety or eco-driving score.
It cannot be equals to true
if status is not tripValid
.
info
If status
equals tripValid
, the DriveQuant servers returns a list of information codes. These are not errors.
error
If status
equals tripError
, error gives you more information about the error that occurred.
This object also provides a method, getTrip()
, to retrieve from the local database the saved DKTrip if status
is equal to tripValid
. In case of error, this method returns nil
.
engineSpeedNotAvailable
The engine speed is not available. The trip analysis is performed with an estimated value of the engine speed.
engineSpeedIsNull
The engine speed is always at 0 rpm while the vehicle is moving. The trip analysis is performed but with an estimated value of the engine speed.
noVehicleCharacteristics
The vehicle characteristics are not set or some values are missing. The trip analysis is performed with generic vehicle model parameters.
dataLoss
More than 25% of data loss is detected during the trip.
distanceTooShort
The trip was analysed but the distance is not sufficient to provide an accurate energy analysis.
invalidVehicleCharacteristics
The vehicle characteristics are not in the range of available values. See vehicle characteristics for range limits.
invalidVehicleId
No vehicle found for the vehicleId
provided to the API request.
noAccountSet
The account
block is not set in the trip data.
noRouteObjectFound
The route
block is not available in the trip data.
invalidRouteDefinition
Error when parsing the route
block
noVelocityData
The vehicle or GPS velocity is not available
invalidSamplingPeriod
The input variables have an invalid acquisition period.
invalidCustomerId
Unknown account
value. Unauthorised access.
noDateFound
The field vehicleDate
or gpsDate
is not available.
maxDailyRequestNumberReached
The trip could not be analyzed because you exceeded your daily request quota.
dataError
The service failed to process your data. There is a need to diagnose your data to determine the origin of this problem.
invalidRouteVectors
The route
vectors are not of the same size, the service cannot perform the analysis
missingBeacon
The beacon has not been detected and it is required to validate the trip analysis.
invalidBeacon
A beacon was detected during the trip but it does not have the correct identifiers
duplicateTrip
The duplicate trip feature is enabled and the trip has already been analysed
insufficientGpsData
The number of GPS points is too low
userDisabled
The driver is disabled, the service cannot perform the analysis
invalidUser
The user identifier is not valid.
invalidGpsData
The dates are inconstistent, the service cannot perform the analysis
invalidTrip
The trip has already been analysed by the service and considered as invalid
accountLimitReached
The maximum number of user account reached for the customer
itinId
String
Trip unique identifier.
endDate
Date?
The end date of the trip.
startDate
Date?
The start date of the trip.
vehicleId
String?
The identifier of the vehicle used for this trip, if known.
transportationMode
TransportationMode
declaredTransportationMode
DKDeclaredTransportationMode?
departureCity
String?
The city of the departure of the trip.
arrivalCity
String?
The city of the arrival of the trip.
departureAddress
String?
The full address of the departure of the trip.
arrivalAddress
String?
The full address of the arrival of the trip.
unscored
Bool
true
if has no safety and eco-driving score.
metadata
Dictionary<String, String>?
tripStatistics
DKTripStatistics?
brakeWear
DKBrakeWear?
tireWear
DKTireWear?
ecoDriving
DKEcoDriving?
ecoDrivingContexts
[DKEcoDrivingContext]?
fuelEstimation
DKFuelEstimation?
fuelEstimationContexts
[DKFuelEstimationContext]?
safety
DKSafety?
safetyContexts
[DKSafetyContext]?
safetyEvents
[DKSafetyEvents]?
driverDistraction
DKDriverDistraction?
pollutants
DKPollutants?
speedingStatistics
DKSpeedingStatistics?
speedLimitContexts
[DKSpeedLimitContext]?
calls
[DKCall]?
energyEstimation
DKEnergyEstimation?
advancedEnergyEstimation
[DKAdvancedEnergyEstimation]?
The user has the possibility to declare the transportation mode that was used during a trip to confirm the one detected or to change it, and to declare whether the trip was made as a passenger or as the driver.
Here is the description of the corresponding object:
transportationMode
TransportationMode
passenger
Boolean?
true
if the trip was made as a passenger, false
if the trip was made as the driver.
comment
String?
The comment associated to this declaration.
This object is returned in the TripListener
's tripRecordingStarted()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
This object is returned in the TripListener
's tripRecordingConfirmed()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date
Date when the trip entered into the confirmation state.
This object is returned in the TripListener
's tripRecordingCanceled()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date?
Date when the trip was confirmed if the trip entered into the confirmation state.
cancelationReason
DKTripCancelationReason
Indicates how the trip was canceled.
This object is returned in the TripListener
's tripRecordingFinished()
callback.
localTripId
String
Local and unique trip identifier generated by DriveKit SDK
startMode
StartMode
recordingStartDate
Date
recordingConfirmationDate
Date
Date when the trip was confirmed if the trip entered into the confirmation state.
recordingEndDate
Date
StartMode indicates how the trip is started. It is an enum with the following values:
gps
Automatic start when the SDK detects a change in user's position
beacon
Automatic start due to the presence of a beacon
manual
geozone
Automatic start when the SDK detects that you exit the zone where your vehicle may be parked
bluetooth
Automatic start by detecting a connection to a known vehicle's Bluetooth system
unknown_bluetooth
Automatic start by detecting a connection to an unknown vehicle's Bluetooth system
user
highSpeed
Trip canceled because speed was too high (train, airplane)
noSpeed
Trip canceled because speed was too slow to be made in a vehicle
noBeacon
noBluetoothDevice
missingConfiguration
Trip canceled because DriveKit was not configured
noLocationData
Trip canceled because no location data was recorded
reset
beaconNoSpeed
Trip canceled because the beacon is near the smartphone but there was no movement (zero or low speed)
bluetoothDeviceNoSpeed
Trip canceled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)
appKilled
The trip recording has been canceled due to an app termination. The trip is not sent to the DriveQuant's platform for analysis because it has never entered in confirmation state, or the Bluetooth device/Beacon is required but has not been detected.
TripPoint is an object that contains data for each location registered by the SDK.
latitude
Double
Latitude
longitude
Double
Longitude
speed
Double
Speed in km/h
accuracy
Double
Accuracy of the GPS data in meter
elevation
Double
Elevation in meter
distance
Double
Distance since the beginning of the trip in meter
heading
Double
Heading
duration
Double
Duration since the beginning of the trip in second
TripVehicle is an object that contains vehicle detailed characteristics.
carTypeIndex
Int
1
carEngineIndex
Int
1
carPower
Double
150
carMass
Double
Vehicle mass in kg (min: 700 kg, max: 3500 kg)
1400
carGearboxIndex
Int
2
carConsumption
Double
Combined fuel consumption [l/100km] measured during the New European Driving Cycle (NEDC). (min: 3 l/100km, max: 20 l/100km)
4.5
carAutoGearboxNumber
Int
Number of gear ratios for the automatic gearbox. This parameter is taken into account only if carGearboxIndex
is set to 1.
6
engineDisplacement
double
Engine displacement in liters
1200
frontTireSize
string
Front tire size
"205/55/16"
rearTireSize
string
Rear tire size
"205/55/16"
length
double
Vehicle length in meter
4.5
width
double
Vehicle width in meter
1.8
height
double
Vehicle height in meter
1.45
driveWheels
Int
0
engineCylinderNb
Int
Number of cylinders
4
BeaconData is an object that contains beacon characteristics.
proximityUuid
String
Beacon proximity UUID
major
Int
Beacon major value (optional)
minor
Int
Beacon minor value (optional)
BluetoothData is an object that contains the Bluetooth device characteristics.
macAddress
String
Required MAC address of the device
name
String
Optional display name of the device
Crash information object have the following structure:
with the following enumeration for crash status
crashId
String
Crash unique identifier
date
Date
Crash date
Example: 2023-03-07T09:13:22.461+0200
probability
Int
Crash probability (in %)
latitude
Double
Coordinates (latitude) of the crash
longitude
Double
Coordinates (longitude) of the crash
velocity
Double
Velocity at time of crash
crashStatus
DKCrashStatus
Crash status enum. Two possible values: confirmed
or unconfirmed
userLocationUrl
String?
Otherwise, it is nil
.
DKCrashFeedbackConfig
is an object used to configure the Crash Detection feedback feature.
notification
DKCrashFeedbackNotification
Configuration of the notification
crashVelocityThreshold
Double
Minimal speed when the crash occurred.
For example, if crashVelocityThreshold
is set at 20 km/h and a crash occurred at 10 km/h, feedback will not be sent to the user.
Default value: 0.0 km/h
title
String
Title that appears on the notification
message
String
Message that appears on the notification
crashAlert
DKCrashAlert
Enum value that describes how the user will be noticed when a feedback is asked
Default value: silence
silence
Device will not vibrate nor ring
vibration
Device will vibrate
soundAndVibration
Device will ring and vibrate
noCrash
User said that no crash occurred
confirmed
User confirmed a crash
noFeedback
User did not provide any feedback
none
User said that no crash occurred
minor
User confirmed a minor crash
critical
User confirmed a critical crash
CancelTrip indicates how the trip was cancelled. It is an enum with the following values:
user
highspeed
Trip cancelled because speed was too high (train, airplane)
noSpeed
Trip cancelled because speed was too slow to be in a vehicle
noBeacon
missingConfiguration
Trip cancelled because DriveKit was not configured
noGPSData
Trip cancelled because no GPS data was recorded
reset
beaconNoSpeed
Trip cancelled because the beacon is near the smartphone but there is no movement (zero or low speed)
bluetoothDeviceNoSpeed
Trip cancelled because the Bluetooth device is connected to the smartphone but there was no movement (zero or low speed)
Driver Data component includes an open source graphics library which provides a set of screens to display trip data recorded by the Trip Analysis component and analyzed by DriveQuant services.
The Driver Data component displays the list of trips made by the driver as well as the details of each trip displayed on a map with all driving indicators and driver scores.
Driver Data component gives a direct access to the formatted data on simple and readable screens. This way, you do not need to create specific screens in your application for illustrating driver’s trip analytics.
All the screens that display the trip results are fully customizable. You can configure the information you want to highlight and integrate styling elements from your application such as colors and fonts. The configuration options are detailed later in this section.
The use of this graphic library is not mandatory and you can develop your own screens if their actual style doesn't fit with your mobile application. In this case, the graphics library can be used as an example to design your own visualizations.
The Driver data component includes 2 cards that simplifies the display of driver behaviour scores synthesis:
The driver synthesis scorecard → shows the averages of each of the driving scores calculated over a 7 days since the last trip date.
The last trip widget → displays a short chronological list of the driver's last trips.
Driver Data Component provides a screen, “My synthesis”, where a driver can compare his average performances per week, month or year with reference levels and also with other drivers in the same community.
You can find more details on the iOS and Android documentation.
Each driver has a profile that corresponds to his habits. The driver's profile is determined from a statistical and historical analysis of his driving data:
how frequently the driver uses his car,
his regularity,
the most travelled road context,
the annual distance covered,
and his mobility area.
These information can be displayed to the driver thanks to the Driver Data graphical component of the DriveKit SDK.
DKDriverTimeline
is an object that contains timeline data for the given period.
period
The kind of aggregation period for this timeline
allContext
The list of all global context sorted by date
roadContexts
The dictionary of all road context and their associated list of context data sorted by date
DKPeriod
indicates the aggregation size of each timeline object. It is an enum with the following values:
week
Timeline data is aggregated week by week
month
Timeline data is aggregated month by month
year
Timeline data is aggregated year by year
DKAllContextItem
is an object that contains data for global context for the given period.
date
Date
Start date of the given period
numberTripTotal
Int
Total number of trips made during the given period
numberTripScored
Int
Number of trips made that were long enough to have a score during the given period
distance
Double
Total distance travelled during the given period (in kilometers)
duration
Int
Total trip duration during the given period (in minutes)
safety
Safety's score and sub scores for the given period (present only if safety score is configured and the period has some scored trips)
ecoDriving
Eco-driving's score and sub scores for the given period (present only if eco-driving score is configured and the period has some scored trips)
phoneDistraction
Distraction's score and sub scores for the given period (present only if distraction score is configured)
speeding
Speeding's score and sub scores for the given period (present only if speeding score is configured)
drivingConditions
Advanced informations for a given period (total trip and distance for a specific DKDrivingCategory and by DKWeather, distance travelled by day/night and by weekdays/weekend)
DKSafety is an object that contains data for safety's score and sub scores.
score
Double
Global safety score for the given period (ranging from 3 to 10)
acceleration
Int
Number of harsh accelerations during the given period
braking
Int
Number of hard breakings during the given period
adherence
Int
Number of adherence limits during the given period
DKEcoDriving
is an object that contains data for eco-driving's score and sub scores.
score
Double
Global eco-driving score for the given period (ranging from 6 to 10)
efficiencyAcceleration
Double
Sub score of acceleration efficiency for the given period (ranging from -5 to 5)
efficiencyBrake
Double
Sub score of braking efficiency for the given period (ranging from -5 to 5)
efficiencySpeedMaintain
Double
Sub score of speed maintain efficiency for the given period (ranging from 0 to 5)
fuelVolume
Double
Fuel consumption during the given period (in liters)
fuelSaving
Double
Achievable fuel savings during the given period (in liters)
co2Mass
Double
CO₂ mass consumed during the given period (in kilograms)
DKDistraction
is an object that contains data for distraction's score and sub scores.
score
Double
Global distraction score for the given period (ranging from 0 to 10)
unlock
Int
Number of screen unlocks during the given period
lock
Int
Number of screen locks during the given period
callForbiddenDuration
Int
Duration of forbidden calls during the given period (in seconds)
numberTripWithForbiddenCall
Int
Number of trips during which the driver made forbidden calls during the given period
callForbidden
Int
Number of forbidden calls during the given period
callAuthorizedDuration
Int
Duration of authorized calls during the given period (in seconds)
callAuthorized
Int
Number of authorized calls during the given period
DKSpeeding
is an object that contains data for speeding's score and sub scores.
score
Double
Global speeding score for the given period (ranging from 0 to 10)
speedingDuration
Int
Overspeeding duration during the given period (in seconds)
speedingDistance
Double
Overspeeding distance travelled during the given period (in meters)
DKDrivingConditions
is an object that contains advanced driving information for the given period.
tripCountByCategory
Total trips count by driving category
distanceByCategory
Total distance in km by driving category
tripCountByWeatherType
Total trips count by weather category
distanceByWeatherType
Total distance in km count by weather category
dayDistance
Double
Total distance traveled by the day in km
nightDistance
Double
Total distance traveled by night in km
weekdaysDistance
Double
Total distance traveled during weekdays in km
weekendDistance
Double
Total distance traveled during weekend in km
lessThan2Km
Trip distance strictly below 2
km
from2To10Km
Trip distance in [2, 10[
km
from10To50Km
Trip distance in [10, 50[
km
from50To100Km
Trip distance in [50, 100[
km
moreThan100Km
Trip distance is equals or above 100
km
DKRoadContextItem
is an object that contains data for the given road context and given period.
type
Road context for the given period
date
Date
Start date of the given period
numberTripTotal
Int
Total number of trips made during the given period and road context
numberTripScored
Int
Number of trips made that were long enough to have a score during the given period and road context
distance
Double
Total distance travelled during the given period and road context (in kilometers)
duration
Int
Total trip duration during the given period and road context (in minutes)
safety
Safety's score and sub scores for the given period and road context (present only if safety score is configured and the period has some scored trips)
ecoDriving
Eco-driving's score and sub scores for the given period and road context (present only if eco-driving score is configured and the period has some scored trips)
DKRoadContext
indicates the kind of roads where the data was gathered. It is an enum with the following values:
trafficJam
The targeted driver was in traffic jams
heavyUrbanTraffic
The targeted driver was in dense city roads
city
The targeted driver was in light traffic city roads
suburban
The targeted driver was in suburban or countryside roads
expressways
The targeted driver was in express ways
DKDriverProfile
is the object describing the driver profile.
distance
Distance class
activity
Activity class
regularity
Regularity class
mainRoadContext
Main road context
mobility
Mobility class
statistics
Statistics about the driver
weekRegularity
Information about driver’s week regularity
monthRegularity
Information about driver’s month regularity
distanceEstimation
Distance estimation by week, month or year
roadContextInfoByRoadContext
Contains information about road contexts
commonTripByType
Provides information about common trips, by type of trip
mobilityAreaRadiusByType
Provides radius of mobility area by type of mobility
DKDistanceProfile
indicates the distance class of the driver.
.veryShort
Very short distance driver
less than 5 000
.short
Short distance driver
5 000 to 10 000
.medium
Medium distance driver
10 000 to 20 000
.long
Long distance driver
20 000 to 40 000
.veryLong
Professional driver
more than 40 000
DKActivityProfile
indicates the activity class of the driver.
.low
Low activity driver
less than 30 %
.medium
Medium activity driver
30 to 60 %
.high
High activity driver
more than 60 %
DKRegularityProfile
indicates the regularity class of the driver.
.regular
Regular driver
.intermittent
Intermittent driver
DKMobilityProfile
indicates the mobility class of the driver.
.narrow
90% of trips are within a radius of less than 10 km
.small
90% of trips are within a radius of less than 20 km
.medium
90% of trips are within a radius of less than 30 km
.large
90% of trips are within a radius of less than 50 km
.wide
90% of trips are within a radius of less than 100 km
.vast
90% of trips are within a radius of 100 km or more
DKDriverStatistics
is an object providing statistics about the driver.
tripsNumber
Int
Total number of trips
totalDistance
Int
Total distance (in km)
totalDuration
Int
Total driving duration (in min)
weekNumber
Int
Number of weeks since user registration
activeWeekNumber
Int
Number of active weeks since user registration
monthNumber
Int
Number of months since user registration
activeMonthNumber
Int
Number of active months since user registration
peakTime
DKTime
Peak time trip starts
peakDay
DKDay
Weekday with most trips completed
DKDriverRegularity
is an object providing information about driver’s regularity.
periodNumber
Int
Number of weeks or months used to calculate regularity
tripNumberMean
Int
Average number of trips per week or month
tripNumberStandardDeviation
Int
Standard deviation of the number of trips per week or month
distanceMean
Int
Average weekly or monthly distance (in km)
distanceStandardDeviation
Int
Standard deviation of the weekly or monthly distance (in km)
durationMean
Int
Average weekly or monthly driving duration (in min)
durationStandardDeviation
Int
Standard deviation of the weekly or monthly driving duration (in min)
DKDriverDistanceEstimation
is an object providing distance estimation by week, month or year.
weekDistance
Int
Estimated weekly distance (in km)
monthDistance
Int
Estimated monthly distance (in km)
yearDistance
Int
Estimated annual distance (in km)
confidence
Confidence level indicator, based on the available data
DKDriverDistanceEstimationConfidence
indicates the distance estimation confidence class.
.low
If less than 8 weeks since driver’s subscription
.medium
If between 9 and 16 weeks since driver’s subscription
.high
If more than 16 weeks since driver’s subscription
DKRoadContextInfo
is an object providing information about road context for the driver.
roadContext
Road context
distancePercentage
Double
Percentage of total distance driven in this context
durationPercentage
Double
Percentage of total duration driven in this context
consumedEnergyPercentage
Double
Percentage of total energy driven in this context
DKCommonTripType
indicates the type of trip.
.mostFrequent
Most frequent trip
.unknown
Unknown type for the SDK (if a new type is added but the SDK is not up to date)
DKCommonTrip
is an object providing information about a trip.
type
Type of trip
tripNumber
Int
Number of trips
distanceMean
Int
Average trip distance (in km)
durationMean
Int
Average trip duration (in min)
roadContext
Road context type
DKMobilityAreaType
indicates the type of mobility area.
.percentile50Th
The radius including 50% of all the user’s trips
.percentile90Th
The radius including 90% of all the user’s trips
Before starting DriveKit Driver Data integration, make sure that you have initialized DriveKit.
If you use DriveKit Driver Data without having initialized DriveKit, an exception will be generated and the SDK will not work in your application.
To add Driver Data module to your app, add the following line to your dependencies in your application build.gradle
file:
If you have disabled the SDK auto-initialization, an initialization phase is required to use the functions offered by the Driver Data component. To initialize Driver Data component in your app, you must call the initialization method in onCreate
method of your application class.
To get Driver trips, you have to call the following method:
SynchronizationType
can have 2 values:
DEFAULT
: if this value is used, the SDK will try to synchronize local trips with DriveQuant backend to get new trips or modified trips, and then return the trip list via the completionHandler.
CACHE
: if this value is used, no synchronization will be performed and only trips previously synchronized will be return via the completionHandler.
An implementation of TripsQueryListener
must be provided in order to retrieve trips.
The status in onResponse
have one of the following values:
NO_ERROR
: Synchronization has been successfully performed.
CACHE_DATA_ONLY
: SynchronizationType has been set to CACHE
.
FAILED_TO_SYNC_TRIPS
: Synchronization has failed, only trips previously synchronized are returned.
SYNC_ALREADY_IN_PROGRESS : Another trip list synchronization is already in progress
The second argument of the onResponse
method is a list of Trip objects.
Example:
To get a specific trip, you have to call the following method:
The itinId
parameter is the unique identifier for a trip.
An implementation of TripQueryListener
must be provided in order to retrieve the trip.
When you call this method, you will get trip data and trip safety events. If safety events are not synchronized locally for the trip, a synchronization with DriveQuant backend will be performed and then, the trip will be returned with safety events synchronized.
TripSyncStatus can have the same value as above and the value FAILED_TO_SYNC_SAFETY_EVENTS
if the safety events synchronization failed.
The second argument of the onResponse
method is the requested Trip object, if exists.
Example:
To get road data of the trip (latitude, longitude), you have to call the following method:
An implementation of RouteQueryListener
must be provided in order to retrieve the trip.
RouteStatus
can have 2 values:
NO_ERROR
: The trip has been successfully retrieved.
FAILED_TO_RETRIEVE_ROUTE
: Route has not been synchronized. route
parameter will be null
.
Example:
To delete a trip, you have to call the following method:
The itinId
parameter is the unique identifier for a trip.
Example:
To get driver synthesis data, you have to call the following method:
An implementation of SynthesisQueryListener must be provided in order to retrieve synthesis data.
SynthesisStatus
in the callback can have 3 values:
NO_ERROR
: Synchronization has been successfully performed.
CACHE_DATA_ONLY
: SynchronizationType has been set to cache.
FAILED_TO_SYNC_SYNTHESIS_CACHE_ONLY
: Synchronization has failed, only data retrieved during the last synchronisation are returned.
Example:
To get driver timelines, you have to call the following method:
periods
DKTimelinePeriod
Get timeline data in a specific period of time.
Possible values are : WEEK
, MONTH
, YEAR.
synchronizationType
SynchronizationType
Define the source of the timelines data you want to retrieve.
Possible values are:
CACHE
: No sync will be performed and the data retrieved during the last sync will be returned via the callback
.
DEFAULT
: the SDK will try to synchronize timelines with DriveQuant backend and then return them via the callback
.
ignoreItemsWithoutTripScored
Boolean
The TimelineSyncStatus
enum values are:
CACHE_DATA_ONLY
: SynchronizationType has been set to CACHE.
NO_ERROR
: Sync has been successfully performed.
FAILED_TO_SYNC_TIMELINE_CACHE_ONLY
: Sync has failed, only data retrieved during the last sync are returned.
NO_TIMELINE_YET
: Sync has been successfully performed and there is currently no timeline.
The second argument in the callback
is a list of DKDriverTimeline object, one per requested period.
To get driver profile, you have to call the following method:
SynchronizationType
can have 2 values:
DEFAULT
: if this value is used, the SDK will try to synchronize the driver profile with DriveQuant backend and then return it via the completionHandler.
CACHE
: if this value is used, no synchronisation will be performed and the data retrieved during the last synchronisation will be returned via the callback.
DKDriverProfileStatus
in the callback can take 4 values:
SUCCESS
: Synchronization type has been successfully performed.
FAILED_TO_SYNC_DRIVER_PROFILE_CACHE_ONLY
: Synchronisation has failed, only data retrieved during the last synchronisation is returned.
NO_DRIVER_PROFILE_YET
: Synchronisation has been successfully performed and there is currently no driver profile for this user.
FORBIDDEN_ACCESS
: Your team doesn’t have access to this data.
The second argument in the callback is the DKDriverProfile
object requested.
Example:
DKDriverTimeline
is an object that contains timeline data for the given period.
DKPeriod
indicates the aggregation size of each timeline object. It is an enum with the following values:
DKAllContextItem
is an object that contains data for global context for the given period.
DKSafety
is an object that contains data for safety's score and sub scores.
DKEcoDriving
is an object that contains data for eco-driving's score and sub scores.
DKDistraction
is an object that contains data for distraction's score and sub scores.
DKSpeeding
is an object that contains data for speeding's score and sub scores.
DKDrivingConditions
is an object that contains advanced driving information for the given period.
DKRoadContextItem
is an object that contains data for the given road context and given period.
RoadContext
indicates the kind of roads where the data was gathered. It is an enum with the following values:
DKDriverProfile
is the object describing the driver profile.
DKDistanceProfile
indicates the distance class of the driver.
DKActivityProfile
indicates the activity class of the driver.
DKRegularityProfile
indicates the regularity class of the driver.
DKMobilityProfile
indicates the mobility class of the driver.
DKDriverStatistics
is an object providing statistics about the driver.
DKDriverRegularity
is an object providing information about driver’s regularity.
DKDriverDistanceEstimation
is an object providing distance estimation by week, month or year.
DKDriverDistanceEstimationConfidence
indicates the distance estimation confidence class.
DKRoadContextInfo
is an object providing information about road context for the driver.
DKCommonTripType
indicates the type of trip.
DKCommonTrip
is an object providing information about a trip.
DKMobilityAreaType
indicates the type of mobility area.
This section introduces graphical elements that simplify the display of driver behaviour scores synthesis.
The Driver Data component includes a component to visualise the average performance of a driver.
The synthesis scorecard shows as main information the averages of each of the driving scores calculated over a 7 days since the last trip date.
The synthesis scorecard also indicates, over this period, the number of trips performed as well as the total distance and driving duration.
The component allows you to select the scores displayed and the order in which they are displayed. To move from one score to another, simply swipe the scorecards.
To include the scorecards into your app, call the following method:
The value .speeding can be set only if this configuration is enabled for your API key.
The Driver Data component includes a widget to display a short chronological list of the driver's last trips.
With the last trip widget, the driver can get a quick overview of his last 10 trips with a simple swipe.
Each small card corresponds to a trip and the user can access the full details and map view by tapping on the current card.
By selecting the last card, the user can access the list of all the trips.
To include the last trip widget into your app, call the following method:
And embed the returned view into your layout.
My synthesis screen contains two very interesting insights for the driver:
His level against a reference scale that tells him whether he needs to make efforts and progress ;
His level in regard to the performance of other drivers belonging to the same organisation as him. The comparison is an interesting lever to motivate the driver to improve his driving.
For each selectable period, the driver will be able to view his average score computed by services that run on the DriveQuant platform.
The user can easily navigate to consult:
The evolution of his driving scores by theme compared to the previous active period ;
His driving score compared to the community thanks to the minimal, median and max community scores ;
How many trips and total distance he made during the selected period.
To include the “My Synthesis” screen into your app, call the following method:
And present the returned view controller using your app’s navigation API.
You can select which scores you want to display on the screen as well as the scores ordering, by calling the following method:
Default and accepted values are:
For .distraction
and .speeding
scores, make sure that the services are activated on your DriveQuant account or the SDK will filter them out and they will not be displayed in the UI even if you add them here.
My Driver Profile has two main screens:
The first screen displays information on driving habits and the main characteristics that define a driver's profile.
The second screen highlights the driving conditions that the driver has experienced during his trips.
The main screen is divided into three parts:
The first describes the different components of the driver profile.
The second one displays the estimated and actual distances per period (week, month and year).
The third one gives the most common driver’s trip in terms of distance and duration.
Every driver has a signature that depends on how they use their vehicle. The driver profile function gives an accurate overview of the driver's profile based on an analysis of his driving data.
We have divided the driver profile into 5 characteristics that depends on key variables:
the annual distance driven per year,
the mobility area that includes 90% of the driver’s trips,
the percentage of weeks during which the driver has used his vehicle,
the regularity based on the relative standard deviations of the weekly distance and trip number,
the main driving context.
These cards compare for different periods (week, month and year)the actual distance (ie. recorded) with the estimated distance computed from the driver historical data.
The purpose of this section is to highlight the driver's most common trip in terms of duration and distance.
To include the “Driver Profile” screen into your app, call the following method:
And present the returned view controller using your app’s navigation API.
To visualize the exposure to the external conditions, we have embedded a screen in the graphical component DriverData UI representing the distances covered by the driver in these conditions and per period: week, month and year.
The driver can scroll through cards to visualize the conditions that result from the analysis of his trips:
the ranges of distances mostly traveled;
trips made during the week or on weekends;
the types of roads travelled;
the weather conditions;
day and night trips;
This information helps the driver to be conscious of the inherent risks and is useful to personalize the driving advice.
You can access this screen by clicking on the button “View my driving conditions” in the main screen.
If you want to include the “Driving Conditions” screen into your app as a standalone screen, call the following method:
And present the returned view controller using your app’s navigation API.
The SDK includes a feature that allows the user to manually delete a trip. Depending on your use case, you can allow or prohibit the deletion of a trip.
Therefore, the SDK contains a setting parameter to show or hide the delete button. The delete trip button is displayed as a "trash can" and appears at the top right of the trip detail screen.
By default delete trip button is enabled. To disable it, call the following method with parameter enable
set to true
:
The analyzed trips are displayed on a list. This list shows the grouped trips by day from the most recent to the oldest one.
If more than one trip have been completed in a day, the trips for a day can be sorted in ascending or descending order of time.
By default, trips are sorted in ascending order, to change it, call the following method with parameter dayTripDescendingOrder
set to true
:
If trip advice is configured for your DriveQuant account, drivers will receive trip advice at the end of a trip according to their driving.
For this advice, you can enable a feedback screen that allows your drivers to send a feedback about the relevance of the advice.
By default, this screen is enabled but you can disable it by calling the following method withe parameter enable set to false
:
The DriveKit SDK can detect alternative modes of transport such as public transport. In this case, the driver behaviour is not evaluated since he is not in a driving situation.
The Driver Data component automatically splits the rated trips from those that should not be rated in two separate lists.
The main list contains the trips scored and corresponding to transport modes where the user is in a driving situation (car, motorbike or truck).
The secondary list displays the trips identified in transportation modes where the user is not in a driving situation.
We have chosen to distinguish these trips and separate them into two independent lists. The list of main trips (i.e. scored) is always displayed by default. The list of alternative trips (i.e. not scored) can be shown or hidden according to your needs. By default, it is not displayed.
When this function is enabled, a filter icon appears in the upper right corner of the trip list screen. By clicking on it, you can select the list of trips made with an alternative mode of transport. To display the list of trips identified as alternative transportation modes, you can use the code below.
⚠️ It is different from the itinId
property returned in the object.
[
]
?
The transportation mode used for this trip, see for the description of the possible values.
The transportation mode declared by the user. See .
Your specific data attached to the trip. See .
Indicators that characterize the trip conditions. See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
See .
The transportation mode declared by the user for this trip. See for the description of the possible values.
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
Possible values are described .
⚠️ It is different from the itinId
property returned in the object, which corresponds to the unique trip identifier generated after the data analysis.
Indicates how the trip started. Possible values are describe .
Date when DriveKit has started the trip recording. ⚠️ It is not the recalculated trip start date returned in after DriveQuant platform's analysis.
Date when DriveKit has terminated the trip recording. ⚠️ It is not the trip end date returned in after DriveQuant platform's analysis..
Trip started manually by calling the method
Trip canceled by calling the method
Trip canceled because the beacon was not detected while it was
Trip canceled because the Bluetooth device was not detected while it was .
Trip canceled because SDK configuration has been .
Vehicle power in hp. This value must be entered in horsepower. In case you only have the engine power in kW you can apply the following formula: (min: 40 hp, max 450 hp)
When a crash is confirmed and is activated, an URL of the map that will display the location data is returned.
Trip cancelled by calling the method
Trip cancelled because the beacon was not detected while it was
Trip cancelled because SDK configuration has been
[]
[: []]
?
?
?
?
?
[
: Int]
[
: Double]
[
: Int]
[
: Double]
?
?
t
Map<, >
Map<, >
Map<, Int>
If set to true
, the returned timeline data will not contain items ( and ) where there are only unscored trips.
Attribute
Type
Description
period
The kind of aggregation period for this timeline
allContext
List<DKAllContextItem>
The list of all global context sorted by date
roadContexts
Map<RoadContext, List<DKRoadContextItem>>
The map of all road context and their associated list of context data sorted by date
WEEK
Timeline data is aggregated week by week
MONTH
Timeline data is aggregated month by month
YEAR
Timeline data is aggregated year by year
Attribute
Type
Description
date
Date
Start date of the given period
numberTripTotal
Int
Total number of trips made during the given period
numberTripScored
Int
Number of trips made that were long enough to have a score during the given period
distance
Double
Total distance travelled during the given period (in kilometers)
duration
Int
Total trip duration during the given period (in minutes)
safety
Safety's score and sub scores for the given period (present only if safety score is configured and the period has some scored trips)
ecoDriving
Eco-driving's score and sub scores for the given period (present only if eco-driving score is configured and the period has some scored trips)
phoneDistraction
Distraction's score and sub scores for the given period (present only if distraction score is configured)
speeding
Speeding's score and sub scores for the given period (present only if speeding score is configured)
drivingConditions
Advanced informations for a given period (total trip and distance for a specific DKDrivingCategory and by DKWeather, distance travelled by day/night and by weekdays/weekend)
score
Double
Global safety score for the given period (ranging from 3 to 10)
acceleration
Int
Number of harsh accelerations during the given period
braking
Int
Number of hard breakings during the given period
adherence
Int
Number of adherence limits during the given period
score
Double
Global eco-driving score for the given period (ranging from 4 to 10)
efficiencyAcceleration
Double
Sub score of acceleration efficiency for the given period (ranging from -5 to 5)
efficiencyBrake
Double
Sub score of braking efficiency for the given period (ranging from -5 to 5)
efficiencySpeedMaintain
Double
Sub score of speed maintain efficiency for the given period (ranging from 0 to 5)
fuelVolume
Double
Fuel consumption during the given period (in liters)
fuelSaving
Double
Achievable fuel savings during the given period (in liters)
co2Mass
Double
CO₂ mass consumed during the given period (in kilograms)
score
Double
Global distraction score for the given period (ranging from 0 to 10)
unlock
Int
Number of screen unlocks during the given period
lock
Int
Number of screen locks during the given period
callForbiddenDuration
Int
Duration of forbidden calls during the given period (in seconds)
numberTripWithForbiddenCall
Int
Number of trips during which the driver made forbidden calls during the given period
callForbidden
Int
Number of forbidden calls during the given period
callAuthorizedDuration
Int
Duration of authorised calls during the given period (in seconds)
callAuthorized
Int
Number of authorised calls during the given period
score
Double
Global speeding score for the given period (ranging from 0 to 10)
speedingDuration
Int
Overspeeding duration during the given period (in seconds)
speedingDistance
Double
Overspeeding distance travelled during the given period (in meters)
tripCountByCategory
Map<
DKDrivingCategory
, Int>
Total trips count by driving category
distanceByCategory
Map<
DKDrivingCategory
, Double>
Total distance in km by driving category
tripCountByWeatherType
Map<
DKWeather
, Int>
Total trips count by weather category
distanceByWeatherType
Map<
DKWeather
, Double>
Total distance in km count by weather category
dayDistance
Double
Total distance traveled by the day in km
nightDistance
Double
Total distance traveled by night in km
weekdaysDistance
Double
Total distance traveled during weekdays in km
weekendDistance
Double
Total distance traveled during weekend in km
LESS_THAN_2_KM
Trip distance strictly below 2
km
FROM_2_TO_10_KM
Trip distance in [2, 10[
km
FROM_10_TO_50_KM
Trip distance in [10, 50[
km
FROM_50_TO_100_KM
Trip distance in [50, 100[
km
MORE_THAN_100_KM
Trip distance is equals or above 100
km
type
Road context for the given period
date
Date
Start date of the given period
numberTripTotal
Int
Total number of trips made during the given period and road context
numberTripScored
Int
Number of trips made that were long enough to have a score during the given period and road context
distance
Double
Total distance travelled during the given period and road context (in kilometers)
duration
Int
Total trip duration during the given period and road context (in minutes)
safety
Safety's score and sub scores for the given period and road context (present only if safety score is configured and the period has some scored trips)
ecoDriving
Eco-driving's score and sub scores for the given period and road context (present only if eco-driving score is configured and the period has some scored trips)
TRAFFIC_JAM
The targeted driver was in traffic jams
HEAVY_URBAN_TRAFFIC
The targeted driver was in dense city roads
CITY
The targeted driver was in light traffic city roads
SUBURBAN
The targeted driver was in suburban or countryside roads
EXPRESSWAYS
The targeted driver was in express ways
distance
Distance class
activity
Activity class
regularity
Regularity class
mainRoadContext
Main road context
mobility
Mobility class
statistics
Statistics about the driver
weekRegularity
Information about driver’s week regularity
monthRegularity
Information about driver’s month regularity
distanceEstimation
Distance estimation by week, month or year
roadContextInfoByRoadContext
Map<RoadContext, DKRoadContextInfo>
Contains information about road contexts
commonTripByType
Map<DKCommonTripType, DKCommonTrip>
Provides information about common trips, by type of trip
mobilityAreaRadiusByType
Map<DKMobilityAreaType, Int>
Provides radius of mobility area by type of mobility
VERY_SHORT
Very short distance driver
less than 5000
SHORT
Short distance driver
5000 to 10000
MEDIUM
Medium distance driver
10000 to 20 000
LONG
Long distance driver
20 000 to 40 000
VERY_LONG
Professional driver
more than 40 000
LOW
Low activity driver
less than 30 %
MEDIUM
Medium activity driver
30 to 60 %
HIGH
High activity driver
more than 60 %
REGULAR
Regular driver
INTERMITTENT
Intermittent driver
NARROW
90% of trips are within a radius of less than 10 km
SMALL
90% of trips are within a radius of less than 20 km
MEDIUM
90% of trips are within a radius of less than 30 km
LARGE
90% of trips are within a radius of less than 50 km
WIDE
90% of trips are within a radius of less than 100 km
VAST
90% of trips are within a radius of 100 km or more
tripsNumber
Int
Total number of trips
totalDistance
Int
Total distance (in km)
totalDuration
Int
Total driving duration (in min)
weekNumber
Int
Number of weeks since user registration
activeWeekNumber
Int
Number of active weeks since user registration
monthNumber
Int
Number of months since user registration
activeMonthNumber
Int
Number of active months since user registration
peakTime
DKTime
Peak time trip starts
peakDay
DKDay
Weekday with most trips completed
periodNumber
Int
Number of weeks or months used to calculate regularity
tripNumberMean
Int
Average number of trips per week or month
tripNumberStandardDeviation
Int
Standard deviation of the number of trips per week or month
distanceMean
Int
Average weekly or monthly distance (in km)
distanceStandardDeviation
Int
Standard deviation of the weekly or monthly distance (in km)
durationMean
Int
Average weekly or monthly driving duration (in min)
durationStandardDeviation
Int
Standard deviation of the weekly or monthly driving duration (in min)
weekDistance
Int
Estimated weekly distance (in km)
monthDistance
Int
Estimated monthly distance (in km)
yearDistance
Int
Estimated annual distance (in km)
confidence
Confidence level indicator, based on the available data
LOW
If less than 8 weeks since driver’s subscription
MEDIUM
If between 9 and 16 weeks since driver’s subscription
HIGH
If more than 16 weeks since driver’s subscription
roadContext
Road context
distancePercentage
Double
Percentage of total distance driven in this context
durationPercentage
Double
Percentage of total duration driven in this context
consumedEnergyPercentage
Double
Percentage of total energy driven in this context
MOST_FREQUENT
Most frequent trip
UNKNOWN
Unknown type for the SDK (if a new type is added but the SDK is not up to date)
type
Type of trip
tripNumber
Int
Number of trips
distanceMean
Int
Average trip distance (in km)
durationMean
Int
Average trip duration (in min)
roadContext
Road context type
PERCENTILE_50TH
The radius including 50% of all the user’s trips
PERCENTILE_90TH
The radius including 90% of all the user’s trips
My Driver Profile has two main screens
The first screen displays information on driving habits and the main characteristics that define a driver's profile.
The second screen highlights the driving conditions that the driver has experienced during his trips.
The main screen is divided into three parts:
The first describes the different components of the driver profile.
The second one displays the estimated and actual distances per period (week, month and year).
The third one gives the most common driver’s trip in terms of distance and duration.
Every driver has a signature that depends on how they use their vehicle. The driver profile function gives an accurate overview of the driver's profile based on an analysis of his driving data.
We have divided the driver profile into 5 characteristics that depends on key variables:
the annual distance driven per year
the mobility area that includes 90% of the driver’s trips,
the percentage of weeks during which the driver has used his vehicle,.,
the regularity based on the relative standard deviations of the weekly distance and trip number.
the main driving context.
These cards compare for different periods (week, month and year)the actual distance (ie. recorded) with the estimated distance computed from the driver historical data.
The purpose of this section is to highlight the driver's most common trip in terms of duration and distance.
To include the “Driver Profile” screen into your app, call the following method:
And present the returned view controller using your app’s navigation API.
To visualize the exposure to the external conditions, we have embedded a screen in the graphical component DriverData UI representing the distances covered by the driver in these conditions and per period: week, month and year.
The driver can scroll through cards to visualize the conditions that result from the analysis of his trips:
the ranges of distances mostly traveled;
trips made during the week or on weekends;
the types of roads travelled;
the weather conditions;
day and night trips;
This information helps the driver to be conscious of the inherent risks and is useful to personalize the driving advice.
You can access this screen by clicking on the button “View my driving conditions” in the main screen.
If you want to include the “Driving Conditions” screen into your app as a standalone screen, call the following method:
And present the returned view controller using your app’s navigation API.
Before starting DriveKit Driver Data UI integration, make sure that you have initialized DriverData and Common UI components, especially if you have disabled the SDK auto-initialization.
To add Driver Data UI module to your app, add the following line to your dependencies in your application build.gradle file:
A Google API Key is mandatory in order to use Driver Data UI. Without it, the trip detail screen will not work because it draws the desired trip using the Google Maps SDK that requires credentials.
According to the official documentation, please check that you already have:
a billing account
Maps SDK for Android enabled
If you already have a Google API Key that can be used for Maps SDK, directly go to the Adding the API Key to your app section
Please follow the official documentation here to create your own Google API Key.
Please follow the official documentation here to add the API Key to your application project.
If you have disabled the SDK auto-initialization, the Driver Data UI module must also be manually initialized.
Then, to initialize the module in your app, you must call the initialization method in onCreate
method of your Application class:
To override colors and texts in Driver Data UI SDK, see Common UI configuration.
It is possible to choose the main theme for the trip list. The main theme of the trip list is used to select the score to be displayed on the left side of the trip list. This setting allows you to choose among one of the 6 themes below:
SAFETY
: The driving safety score.
ECO_DRIVING
: The eco-driving score.
DISTRACTION
: The driving distraction score.
DURATION
: The trip distance.
DISTANCE
: The driving duration.
SPEEDING
: The speeding score.
The value SPEEDING
can be set only if this configuration is enabled for your API key.
The main theme can be configured calling the following method:
The default value is SAFETY
.
A trip is analyzed through several dimensions and DriveQuant's services provide multiple categories of scores. Depending on your need, you can highlight the scores of interest and hide some of them. The configuration of the trip detail screen allows to choose the displayed themes and the displaying order. To switch from one theme to another, simply swipe the bottom part of the screen or click on one of the pictograms in the navigation bar at the top of the screen.
The screens that can be displayed are listed below:
The safety analysis results: SAFETY
.
The eco-driving results: ECO_DRIVING
.
The distracted driving results: DISTRACTION
.
The speeding driving results: SPEEDING
.
A scrollable list that displays all the events that occurred during the trip: INTERACTIVE_MAP
.
Synthetic data of the trip as average speed, CO2 emissions, estimated fuel consumption, driving conditions: SYNTHESIS
.
The value SPEEDING
can be set only if this configuration is activated on your team.
Map items can be configured by calling the following method:
The default value is:
[SAFETY, ECODRIVING, DISTRACTION, SPEEDING, INTERACTIVE_MAP, SYNTHESIS]
To show fragment in your activity, you just have to create an instance of TripListFragment
with the following method:
and then show it using a FragmentManager
.
The SDK includes a feature that allows the user to manually delete a trip. Depending on your use case, you can allow or prohibit the deletion of a trip.
Therefore, the SDK contains a setting parameter to show or hide the delete button. The delete trip button is displayed as a "trash can" and appears at the top right of the trip detail screen.
By default delete trip button is enabled. To disable it, call the following method with parameter enableDeleteTrip
set to false
:
The analyzed trips are displayed on a list. This list shows the grouped trips by day from the most recent to the oldest one.
If more than one trip have been completed in a day, the trips for a day can be sorted in ascending or descending order of time.
By default, trips are sorted in ascending order, to change it, call the following method with parameter dayTripDescendingOrder
set to true
:
If trip advice is configured for your DriveQuant account, drivers will receive trip advice at the end of a trip according to their driving.
For this advice, you can enable a feedback screen that allows yours drivers to send a feedback about the relevance of the advice.
By default, this screen is enabled but you can disable it by calling the following method with parameter enable set to false
:
The DriveKit SDK can detect alternative modes of transport such as public transport. In this case, the driver behaviour is not evaluated since he is not in a driving situation.
The Driver Data component automatically splits the rated trips from those that should not be rated in two separate lists.
The main list contains the trips scored and corresponding to transport modes where the user is in a driving situation (car, motorbike or truck).
The secondary list displays the trips identified in transportation modes where the user is not in a driving situation.
We have chosen to distinguish these trips and separate them into two independent lists. The list of main trips (i.e. scored) is always displayed by default. The list of alternative trips (i.e. not scored) can be shown or hidden according to your needs. By default, it is not displayed.
When this function is enabled, a filter icon appears in the upper right corner of the trip list screen. By clicking on it, you can select the list of trips made with an alternative mode of transport. To display the list of trips identified as alternative transportation modes, you can use the code below.
My synthesis screen contains two very interesting insights for the driver:
His level against a reference scale that tells him whether he needs to make efforts and progress ;
His level in regard to the performance of other drivers belonging to the same organisation as him. The comparison is an interesting lever to motivate the driver to improve his driving.
For each selectable period, the driver will be able to view his average score computed by services that run on the DriveQuant platform.
The user can easily navigate to consult:
The evolution of his driving scores by theme compared to the previous active period ;
His driving score compared to the community thanks to the minimal, median and max community scores ;
How many trips and total distance he made during the selected period.
To display the “My Synthesis” screen into your app, call the following method:
You can select which scores you want to display on the screen as well as the scores ordering, by calling the following method:
Default and accepted values are:
For DISTRACTION
and SPEEDING
scores, make sure that the services are activated on your DriveQuant account or the SDK will filter them out and they will not be displayed in the UI even if you add them here.
This section introduces graphical elements that simplify the display of driver behaviour scores synthesis.
The Driver Data component includes a component to visualise the average performance of a driver.
The synthesis scorecard shows as main information the averages of each of the driving scores calculated over a 7 days since the last trip date.
The synthesis scorecard also indicates, over this period, the number of trips performed as well as the total distance and driving duration.
The component allows you to select the scores displayed and the order in which they are displayed. To move from one score to another, simply swipe the scorecards.
To include the scorecards into your app, call the following method:
The value SPEEDING
can be set only if this configuration is enabled for your API key.
The Driver Data component includes a widget to display a short chronological list of the driver's last trips.
With the last trip widget, the driver can get a quick overview of his last 10 trips with a simple swipe.
Each small card corresponds to a trip and the user can access the full details and map view by tapping on the current card.
By selecting the last card, the user can access the list of all the trips.
To include the last trip widget into your app, call the following method:
And embed the returned view into your layout.
The timeline component displays the user's driving score history to help them understand if they are making progress.
The data represents weekly or monthly averages that are calculated periodically by services that run on the DriveQuant platform and automatically synchronised with the DriveKit SDK.
The design is designed to be technical but ergonomic in order to highlight the qualities and weaknesses of the user's driving behaviour.
The user can easily navigate to consult :
the evolution of his driving scores by theme. The safety score out of 10 for example.
the evolution of sub-scores or secondary driving indicators that were used to build the main driving scores. The number of hard braking for example.
The main screen highlights the scores for each theme. The driver can choose between two types of display:
weekly average history
monthly average history
The secondary screens are accessible from the main screen by tapping on "See more details about my score".
They contain the sub-scores of the selected theme. As for the main screens, data is available by week and month.
🛡Safety sub-scores :
Number of accelerations per 100 km
number of brakings per 100 km
Adherence limits per 100 km
🌿 Eco-driving sub-scores:
Acceleration score
Deceleration score
Speed maintain score
Fuel consumption (in l)
Achievable fuel savings (in l)
CO2 mass (in kg)
📱Distraction sub-scores:
Number of phone unlocks per 100 km
Duration of forbidden calls per 100 km
Percentage of trips with forbidden calls
🏎 Speeding sub-scores:
Overspeeding relative duration
Overspeeding relative distance
The DriveKit Vehicle module allows you to select one or more vehicles and to choose the automatic start mode of each vehicle.
The selection of the vehicle is an important step since the driving indicators computed by the application are based on the vehicle characteristics (mass, dimension and powertrain).
There are two types of vehicles that can be added: cars or trucks.
Each declared vehicle is linked to the driver's account.
A start mode can be defined for each vehicle.
Depending on your use case, you can select the type of automatic start mode:
The natural (GPS) mode which relies on the phone sensors.
The Beacon mode which uses a small iBeacon tag.
The Bluetooth mode, which uses a Bluetooth device previously paired to the driver's phone.
DriveKit includes a simple and configurable interface to set up screens in your application from which the driver can configure his vehicle and choose the appropriate start mode.
The advantage of DriveKit is that this information is stored in a local database and synchronised with a remote database.
To add Timeline UI module to your app, add the following line to your dependencies in your application build.gradle file:
Then, to initialize the module in your app, you must call the initialization method in onCreate
method of your Application class:
You can select which scores you want to display on the main screen as well as the scores ordering, by calling the following method:
Default and accepted values:
[ SAFETY
, ECO_DRIVING
, DISTRACTION
, SPEEDING
]
For DISTRACTION
and SPEEDING
scores, make sure that the services are activated on your DriveQuant account or the SDK will filter them out and they will not be displayed in the UI even if you add them here.
The Timeline UI module is available on Cocoapods master repo.
To access the framework in the repository, add the following lines to your Podfile:
Then, run pod install.
Then, to initialize Timeline UI module in your app, you must call the initialization method in didFinishLaunchingWithOptions
method of your AppDelegate:
You can select which scores you want to display on the main screen as well as the scores ordering, by calling the following method:
Default and accepted values:
[ .safety
, .ecoDriving
, .distraction
, .speeding
]
For .distraction
and .speeding
scores, make sure that the services are activated on your DriveQuant account or the SDK will filter them out and they will not be displayed in the UI even if you add them here.
We recommend you to test this component in the before you integrate it in your application.
Before starting DriveKit Timeline UI integration, make sure that you have initialized and modules.
On, you can also find a demo application that contains the DriveKit Timeline component. This code is open source and you can use it as an example.
If you have , the Timeline UI module must also be manually initialized.
Before starting DriveKit Timeline UI integration, make sure that you have initialized and modules.
On, you can also find a demo application that contains the DriveKit timeline component. This code is open source and you can use it as an example.
If you have , the Timeline UI module must also be manually initialized. In the application's AppDelegate file, import DriveKitDriverDataTimelineUI
: