Get started
Prerequisite
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.
Integration
Get module from repository
To add Driver Data module to your app, add the following line to your dependencies in your application build.gradle
file:
Replace $drivekit_version
with the DriveKit version you are using in your app
Initialization
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.
Get driver trips
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 toCACHE
.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.
Trips are returned and sorted by end date in descending order.
Example:
Get specific trip
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:
Get trip road data
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 benull
.
Example:
Delete a trip
To delete a trip, you have to call the following method:
The itinId
parameter is the unique identifier for a trip.
Example:
Get driver synthesis
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:
Get driver timelines
To get driver timelines, you have to call the following method:
Parameter name | Type | Description |
---|---|---|
periods |
| Get timeline data in a specific period of time.
Possible values are : |
synchronizationType | SynchronizationType | Define the source of the timelines data you want to retrieve.
Possible values are:
|
ignoreItemsWithoutTripScored | Boolean | If set to |
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.
Get driver profile
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:
Last updated