LogoLogo
ProductsUse casesDocsSupport
  • Introducing DriveKit
  • DriveKit Guides
  • Get started with drivekit
    • Trip recording lifecycle
    • iOS
      • 🚀Quick start
      • Advanced configurations
      • References
      • iOS DriveKit Demo App
    • Android
      • 🚀Quick start
      • Advanced configurations
      • References
      • Android DriveKit Demo App
      • Android 15 Migration guide
      • Android 14 Migration guide
      • Troubleshooting
  • Trip analysis
    • Introduction
    • iOS
      • Permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (iOS)
    • Android
      • Runtime permissions
      • Trip management
      • TripListener
      • Crash Detection
      • Beacon usage
      • Bluetooth usage
      • Custom metadata
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
      • Android
        • Get started
        • Working hours
        • Driver alert in case of crash
        • Trip recording widget
        • Location sharing
    • REST services
      • Trip
      • References
    • Trip Simulator
      • iOS
      • Android
  • PERMISSIONS UTILS
    • Introduction
    • User interface
      • iOS
        • Get started
        • Main configurations
      • Android
        • Get started
        • Main configurations
  • COMMON UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
    • References
  • DRIVER DATA
    • Introduction
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
      • Android
        • Get Started
        • Advanced configurations
        • Trips widgets
        • My Synthesis
        • My Driver Profile
  • Driver Data Timeline UI
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • Vehicle
    • Introduction
    • iOS
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (iOS)
    • Android
      • Get started
      • Vehicle management
      • Beacon management
      • Bluetooth device management
      • Odometer
      • References (Android)
    • User interface
      • iOS
        • Get started
        • Main configurations
        • Advanced configurations
      • Android
        • Get started
        • Main configurations
        • Advanced configurations
  • DRIVER ACHIEVEMENT
    • Introduction
    • iOS
      • Get started
    • Android
      • Get Started
    • User interface
      • iOS
      • Android
  • CHALLENGE
    • Introduction
    • Important challenge rules
    • iOS
      • Get started
      • References (iOS)
    • Android
      • Get started
      • References (Android)
    • User interface
      • iOS
        • Get started
      • Android
        • Get started
  • GROUP
    • Introduction
    • iOS
      • Get started
    • Android
      • Get started
  • React Native
    • Get started
    • Integration
  • Flutter
    • Get started
    • Integration
  • Push services
    • Introduction
    • Push Trip Data
    • Push Deleted trip
    • Push Crash Data
    • Push Diagnosis Data
  • ADMIN SERVICES
    • Beacon
      • Add
      • Replace
      • Delete
      • Configuration
    • Challenges
      • List of challenges
      • Challenge details
      • Registered users
      • Challenge ranking
      • Users' progress
      • Definitions
    • Customer
      • Activity timeline
    • Driver
      • Timeline
      • Synthesis
      • Identity
      • Status
      • Add or update a metadata
      • Vehicles
      • Profile
      • Application diagnoses
    • Drivers
      • Account
      • Statistics
      • Ranking
      • Expired accounts
    • Group
      • Timeline
      • Synthesis
    • Trips
      • Add or update a metadata
      • Delete a metadata
    • Vehicle
      • Create
      • Characteristics
      • Configuration
      • Statistics
      • Update mileage
      • Tire and brake wear update
      • References
  • Crashes
    • Annotate a crash
    • Revoke crash location URL
  • ENTERPRISE SERVICES
    • Introduction
    • Teams
      • Create a team
      • List of teams
      • Enable or disable a team
    • Hyper-admins
      • Create a hyper-admin
      • List of hyper-admins
      • Delete a hyper-admin
    • Monitoring
      • Get a push trip data report
      • Get a push crash data report
      • Request to retry failed trips
      • Request to retry failed crashes
      • Get the status of a task
  • Release notes
    • Changelog
      • iOS
      • Android
      • UI iOS
      • UI Android
Powered by GitBook
On this page
  • Prerequisites
  • Set up your project
  • Add the TripAnalysis module to your project
  • Configure your backup app's rules
  • Set the API key
  • Set a user id
  • Enable the autostart
  • Runtime permissions
  • What's next?

Was this helpful?

Export as PDF
  1. Get started with drivekit
  2. Android

Quick start

In this part, we will take you through the required basic steps to detect your first trips using DriveKit.

PreviousAndroidNextAdvanced configurations

Last updated 3 months ago

Was this helpful?

Prerequisites

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:

You can also clone the following , configure the required credentials then simply run the quickstart app!

Set up your project

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:

dependencyResolutionManagement {
    repositories {
        (…)
        maven {
            url = uri("https://maven.drivequant.com/repository/android-sdk/")
        }
    }
}
dependencyResolutionManagement {
    repositories {
        (…)
        maven {
            url "https://maven.drivequant.com/repository/android-sdk/"
        }
    }
}
allprojects {
    repositories {
        (…)
        maven {
            url "https://maven.drivequant.com/repository/android-sdk/"
        }
    }
}

Add the TripAnalysis module to your project

To add the Trip Analysis module to your app, add the following line to your dependencies in your appropriate application build Gradle file:

dependencies {
    implementation("com.drivequant.drivekit:drivekit-trip-analysis:$drivekit_version")
}
dependencies {
    implementation 'com.drivequant.drivekit:drivekit-trip-analysis:$drivekit_version'
}

By adding the TripAnalysis module, it will also add the DriveKit Core module and automatically initialize the DriveKit SDK.

Configure your backup app's rules

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:

AndroidManifest.xml
<manifest ... >
    ...
    <application android:allowBackup="true" ... >
        ...
    </application>
</manifest>

Set the API key

Once you've stored your API key in a secure way in your app, configure DriveKit by calling the following method:

fun setApiKey(key: String)

Set a user id

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:

fun setUserId(userId: String)

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.

Enable the autostart

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:

fun activateAutoStart(activate: Boolean)

Runtime permissions

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:

dependencies {
    implementation("com.drivequant.drivekit:drivekit-trip-analysis:$drivekit_version")
    implementation("com.drivequant.drivekit:drivekit-permissions-utils-ui:$drivekitui_version")
}
dependencies {
    implementation "com.drivequant.drivekit:drivekit-trip-analysis:$drivekit_version"
    implementation "com.drivequant.drivekit:drivekit-permissions-utils-ui:$drivekitui_version"
}

Then, call the following code in your project:

PermissionsUtilsUI.showPermissionViews(context, object: PermissionViewListener {
    override fun onFinish() {
        // Code called when requested permissions are properly granted.
    }
})

Congratulations! You now have an app that will automatically detects every trip you will make.

What's next?

Once your first trips are recorded, fine-tune the DriveKit SDK configuration to fit your needs:

Replace $drivekit_versionwith 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.

🚀
repository
changelog
Advanced configurations
https://developer.android.com/identity/data/autobackup#IncludingFiles
here
Troubleshooting
GUID
changelog
Driver Data
Vehicle
Core
TripAnalysis
alert the user once a trip has been analyzed by the DriveQuant servers by displaying a notification
challenges
ranking
badges
crash detection
customize the notification displayed during a trip analysis