All pages
Powered by GitBook
1 of 6

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

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 , 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 , 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 section

Create an API Key

Please follow the official documentation to create your own Google API Key.

Add the API Key

Please follow the official documentation to add the API Key to your application project.

Initialization

If you have , 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

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.

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 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.

DURATION: The trip distance.

  • DISTANCE: The driving duration.

  • SPEEDING: The speeding score.

  • 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.

  • dependencies {
        implementation 'com.drivequant.drivekit:drivekit-driver-data-ui:$drivekitui_version'
    }
    Github repository
    official documentation
    Adding the API Key to your app
    here
    here
    disabled the SDK auto-initialization
    Common UI configuration.
    Trip map items
    fun initialize()
    fun configureTripData(tripData: TripData)
    fun configureMapItems(mapItems: List<MapItem>)
    DriverDataUI.createTripListFragment()
    DriverDataUI.INSTANCE.createTripListFragment();
    supportFragmentManager.beginTransaction()
        .replace(R.id.container, DriverDataUI.createTripListFragment())
        .commit()
    getSupportFragmentManager().beginTransaction()
        .replace(R.id.container, DriverDataUI.INSTANCE?.createTripListFragment())
        .commit();
    

    Android

    Advanced configurations

    Hiding the delete trip button

    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:

    Trip list sorting

    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:

    Trip advice feedback

    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:

    Enable alternative transportation modes display

    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.

    Eco-driving advice
    Alternative transportation mode list
    fun enableDeleteTrip(enableDeleteTrip: Boolean)
    fun dayTripDescendingOrder(dayTripDescendingOrder: Boolean)
    fun enableAdviceFeedback(enableAdviceFeedback: Boolean)
    fun enableAlternativeTrips(enableAlternativeTrips: Boolean)

    My Synthesis

    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:

    Configure scores themes to display

    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.

    DriveKitNavigationController.driverDataUIEntryPoint?.startMySynthesisActivity(context)
    DriveKitNavigationController.INSTANCE.getDriverDataUIEntryPoint().startMySynthesisActivity(context);
    var scores: List<DKScoreType> = DKScoreType.values().toList()
    [SAFETY, ECO_DRIVING, DISTRACTION, SPEEDING]

    Trips widgets

    This section introduces graphical elements that simplify the display of driver behaviour scores synthesis.

    Driver synthesis scorecard

    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 order in which the scorecards are displayed corresponds to the order of the items in the table. To hide a theme, simply do not add it to the table.

    The value SPEEDING can be set only if this configuration is enabled for your API key.

    Last trip widget

    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 Driver Profile

    Introduction

    My Driver Profile has two main screens

    1. The first screen displays information on driving habits and the main characteristics that define a driver's profile.

    fun getLastTripsSynthesisCardsView(
        synthesisCards: List<LastTripsSynthesisCard> = listOf(
            LastTripsSynthesisCard.SAFETY,
            LastTripsSynthesisCard.DISTRACTION,
            LastTripsSynthesisCard.ECO_DRIVING,
            LastTripsSynthesisCard.SPEEDING
        ), listener: SynthesisCardsViewListener
    )
    fun getLastTripsView(
        headerDay: HeaderDay = HeaderDay.DISTANCE,
        lastTripMaxNumber: Int = 10
    ): Fragment {
    The second screen highlights the driving conditions that the driver has experienced during his trips.
    My Driver Profile 2 screens

    Main screen

    The main screen is divided into three parts:

    1. The first describes the different components of the driver profile.

    2. The second one displays the estimated and actual distances per period (week, month and year).

    3. The third one gives the most common driver’s trip in terms of distance and duration.

    Driver’s profile cards

    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.

    Driver's profile cards

    Distance estimation cards

    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.

    Distance estimation cards

    Driver’s usual trip

    The purpose of this section is to highlight the driver's most common trip in terms of duration and distance.

    Driver's usual trip

    A minimum of 2 weeks of activity and 500 km driven is required to display the driver profile data. The accuracy and quality of the results improve with the amount of historical data analysed.

    ​​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.

    Driving conditions screen

    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.

    Driving conditions 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.

    DriveKitNavigationController.driverDataUIEntryPoint?.startDriverProfileActivity(context)
    DriveKitNavigationController.INSTANCE.getDriverDataUIEntryPoint().startDriverProfileActivity(context);
    DriveKitNavigationController.driverDataUIEntryPoint?.startDrivingConditionsActivity(context)
    DriveKitNavigationController.INSTANCE.getDriverDataUIEntryPoint().startDrivingConditionsActivity(context);