This documentation presents the React Native interfaces for the DriveKit SDK on iOS and Android.
The DriveKit SDK for React Native is available with:
The DriveKit libraries for React Native are supported for React Native 0.70 version. It is strongly recommended to use this version or later versions.
First you need to install the Core module. This module is mandatory and includes methods to initialize DriveKit, to configure your API key and to create a user.
To install this module, follow step by step the method described in the Core documentation
After installing the Core component, you need to install the Trip Analysis component which manages the trip recording and the automatic mode configuration.
To install this module, follow step by step the method described in the Trip Analysis documentation
The Driver Data module manages the driver trips display (list and details) and ensures the synchronisation of driver data.
To install this module, follow step by step the method described in the Driver Data documentation
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.
For this purpose, DriveQuant provides the Trip Simulator component based on recorded GPS data.
❗️It is strongly recommended not to integrate this component into an application built for production. This component has been designed to facilitate preliminary testing and should never remain in your production app.
To install this module, follow step by step the method described in the Trip Simulator documentation
To inform the user that the trip has been analyzed, finished or cancelled, the DriveKit libraries for React Native offers listeners so it becomes easy to build notifications on both mobile platforms.
We recommend Notifee library to manage your notifications.
On iOS, you just have to manage notifications using the DriveKit.addEventListener(…)
method. Please refer to the useSetupListeners.ts
on the demo package for example.
Notification that indicates a trip is currently analyzed is driven by the Trip Analysis initialize(…)
method.
To display a notification when the trip is finished or cancelled, it is not possible to handle listeners like the iOS platform, because listeners are not triggered when the device is locked or the app is not in foreground. To manage that limitation, a Headless JS service has been introduced on Trip Analysis component.
Follow these steps :
DKHeadlessJS
on your index.js
file.DKHeadlessJS.js
file on your project.