Skip to main content

Integration Guide

1. Overview​

TelematicsSDK is a library designed to simplify the integration of telematics functionalities into your application. This SDK provides tools for managing user and vehicle data, handling permissions, and starting/stopping telematics services efficiently.

The SDK is available as two modules that integrate the native TelematicsSDKs for iOS and Android and expose the same JavaScript API:

Project typePackage
React Native (bare)@driviantelematics/telematics-sdk-rn
Expo@driviantelematics/telematics-sdk-expo

Both modules share the same version number and API. Choose the one that matches your project; the rest of this documentation applies to both.

This guide explains how to install and configure the SDK in a React Native or Expo project.


2. Prerequisites​

  • React Native
    • @driviantelematics/telematics-sdk-rn: react-native 0.81+
    • @driviantelematics/telematics-sdk-expo: Expo SDK 52+ (react-native 0.76+)
  • Android:
    • Android Studio: 3.0 or higher
    • Android SDK: Minimum SDK version 26
  • iOS:
    • Xcode version 26+
    • Minimum iOS version 17.0

3. Installation​

3.1 Configure GitHub Packages Access​

Both packages are distributed as private packages through GitHub Packages.

Create a ".npmrc" file at the root of your project to access the private dependency with the following content:

@driviantelematics:registry=https://npm.pkg.github.com
//npm.pkg.github.com/:_authToken=REPOSITORY_PAT

Replace REPOSITORY_PAT with the npm access token provided by Sentilant (with read access to the packages). This token is different from the one used to access the iOS SDK repository.

3.2 Install the dependency​

React Native

With npm:

npm install @driviantelematics/telematics-sdk-rn

With yarn:

yarn add @driviantelematics/telematics-sdk-rn

Expo

npx expo install @driviantelematics/telematics-sdk-expo

The module does not request permissions by itself. To request the required permissions at runtime, we recommend react-native-permissions, which is used in the Permissions Setup examples.

3.3 Expo projects​

The Expo module contains native code, so it cannot run in Expo Go. Use a development build instead.

The module does not include an Expo config plugin. The native configuration described in sections 4 and 5 must be applied to the native android and ios folders of your project. If your project does not have them yet, generate them with:

npx expo prebuild

If the native folders are regenerated (for example with npx expo prebuild --clean), the native configuration from sections 4 and 5 must be applied again.

3.4 Updating to a New SDK Version​

To update the module, install the latest release version of the package (for example npm install @driviantelematics/telematics-sdk-rn@latest) and run pod install in the ios folder. The native SDKs are updated together with the module.

4. Platform Setup - Android​

4.1 Add the native SDK repository​

The native Android SDK is downloaded from a private Maven repository. Access is granted via the repository credentials (access key and secret key) provided by Sentilant.

In android/settings.gradle:

pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
plugins { id("com.facebook.react.settings") }

// Should appear only after pluginManagement and plugins
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

repositories {
google()
mavenCentral()

maven {
url = uri("s3://telematics-sdk-repo.s3.amazonaws.com")
credentials(AwsCredentials) {
accessKey = "SDK_REPOSITORY_ACCESS_KEY"
secretKey = "SDK_REPOSITORY_SECRET_KEY"
}
}
}
}

...

4.2 Update minSdkVersion​

In android/build.gradle:

buildscript {
ext {
...
minSdkVersion = 26
...
}
}

4.3 Android Manifest configuration​

In android/app/src/main/AndroidManifest.xml add required permissions:

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
<uses-permission android:name="android.permission.FOREGROUND_SERVICE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />

Change this configuration to true:

<application
...
android:allowBackup="true"
... >
</application>

5. Platform Setup - iOS​

The native iOS Telematics SDK is already included as part of the module dependency. However, for the SDK to be correctly linked and recognized by the iOS application, CocoaPods must install and integrate the native dependencies into the Xcode project.

5.1 Set the minimum iOS version​

The SDK requires iOS 17.0. In ios/Podfile, set the platform version:

platform :ios, '17.0'

5.2 Install the pods​

After installing the dependency, navigate to the iOS folder and run:

cd ios
pod install
cd ..

No additional manual configuration is required on iOS beyond the steps above, as the SDK is already bundled with the module.