DriveQuantPublic / react-native-drivekit

React Native interface for DriveKit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DriveKit React Native SDK

This documentation presents the React Native interfaces for the DriveKit SDK on iOS and Android.

The DriveKit SDK for React Native is available with:

  • Android 6.0 (API 23) and later versions,
  • and iOS 11.0 and later versions.

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.

How to install the DriveKit SDK in your React Native application?

➡️ Step 1: Install the Core module

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


➡️ Step 2: Install the Trip Analysis module

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


➡️ Step 3: Install the Driver Data module

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


➡️ Step 4 : Test your implementation with Trip Simulator

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


➡️ Step 5 : Notify the user about the trip analysis

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.

iOS

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.

Android

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 :

  • Register the Headless task named DKHeadlessJS on your index.js file.
  • Replicate the DKHeadlessJS.js file on your project.

About

React Native interface for DriveKit

License:Apache License 2.0


Languages

Language:Kotlin 30.3%Language:TypeScript 29.7%Language:Swift 19.6%Language:Objective-C++ 7.7%Language:Java 3.6%Language:Ruby 3.6%Language:Objective-C 3.4%Language:JavaScript 2.1%Language:Shell 0.0%