Get Started
Pre-requisite
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.
Integration
To add Driver Data UI module to your app, add the following line to your dependencies in your application build.gradle file:
Replace $drivekitui_version
with the DriveKit version you are using in your app
On a Github repository, you have a demo app and source code of Driver Data UI that you can use as an example.
Google API Key
Introduction
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
Create an API Key
Please follow the official documentation here to create your own Google API Key.
Add the API Key
Please follow the official documentation here to add the API Key to your application project.
Initialization
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:
Override colors and texts
To override colors and texts in Driver Data UI SDK, see Common UI configuration.
Trip list main theme
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
.
Trip map items
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]
The order in which the screens are displayed corresponds to the order of the items in the table. To hide a theme, simply do not add it to the table.
Display fragment
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
.
Last updated