telematics_sdk

Creator: coderz1093

Last updated:

Add to Cart

Description:

telematics sdk

Telematics SDK #
A flutter plugin for tracking the person's driving behavior such as speeding, turning, braking and several other things on iOS and Android.
Disclaimer: This project uses Telematics SDK which belongs to DAMOOV PTE. LTD.
When using Telematics SDK refer to these terms of use
Getting Started #
Initial app setup & credentials #
For commercial use, you need create a developer workspace in DataHub and get InstanceId and InstanceKey auth keys to work with our API.
Android #
Please draw attention that Android SDK supports Gradle 8+ versions only.
AndroidManifest.xml
add to file ./app/src/main/AndroidManifest.xml props:

'xmlns:tools="http://schemas.android.com/tools"' into manifest tag
'tools:replace="android:label"' into __application tag

as shown below:
<manifest
xmlns:tools="http://schemas.android.com/tools">
<application
tools:replace="android:label,android:name">
...
</application>
...
</manifest>

copied to clipboard
add network permissions
<manifest>
...
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
...
copied to clipboard
build.gradle
add to file (module)/build.gradle props:
android {
...
buildTypes {
release {
...
shrinkResources false
minifyEnabled false
...
}
}
...
}
copied to clipboard
Proguard
-keep public class com.raxeltelematics.** {*;}
copied to clipboard
Android Advanced #
SetTrackingSettings


Override application class extends TelematicsSDKApp
import com.telematicssdk.TelematicsSDKApp

class App: TelematicsSDKApp() {

override fun onCreate() {
val api = TrackingApi.getInstance()
api.initialize(this, setTelematicsSettings())
super.onCreate()
}

override fun setTelematicsSettings(): Settings {
val settings = Settings(
stopTrackingTimeout = Settings.stopTrackingTimeHigh,
accuracy = Settings.accuracyHigh,
autoStartOn = true,
elmOn = false,
hfOn = true
)
return settings
}
}
copied to clipboard


add to tag application of file ./app/src/main/AndroidManifest.xml this class name:
<application
android:name=".App">
...
</application>

copied to clipboard


add Telematics SDK repository into (module)/build.gradle
dependencies {
//...
implementation "com.telematicssdk:tracking:2.2.262"
}
copied to clipboard


iOS #
Add permissions in your project's ios/Runner/Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>fetch</string>
<string>location</string>
<string>remote-notification</string>
</array>
<key>NSMotionUsageDescription</key>
<string>Please, provide permissions for this Demo</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Please, provide permissions for this Demo</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Please, provide permissions for this Demo</string>
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>Please, provide permissions for this Demo</string>
<key>BGTaskSchedulerPermittedIdentifiers</key>
<array>
<string>sdk.damoov.apprefreshtaskid</string>
<string>sdk.damoov.appprocessingtaskid</string>
</array>
copied to clipboard
Starting from iOS version 15 and above, as well as Flutter 2.0.6, modification of ios/Runner/AppDelegate.swift is required
You must request permissions for the application before GeneratedPluginRegistrant
Example AppDelegate.swift
Enabling and Disabling the SDK #
Firstly, create trackingAPI object to interact with SDK
import 'package:telematics_sdk/telematics_sdk.dart';

final _trackingApi = TrackingApi();
copied to clipboard
Login
await _trackingApi.setDeviceID(deviceId: "DEVICE_TOKEN");
copied to clipboard
Logout
await _trackingApi.clearDeviceID();
copied to clipboard
Enable the SDK
await _trackingApi.setEnableSdk(enable: true);
copied to clipboard
Disable the SDK
await _trackingApi.setEnableSdk(enable: false);
copied to clipboard
Disable the SDK with force uploading data
await _trackingApi.setDisableWithUpload();
copied to clipboard
Available Methods #
Manual start tracking
await _trackingApi.startManualTracking();
copied to clipboard
Manual stop tracking
await _trackingApi.stopManualTracking();
copied to clipboard
Permissions status
final isAllGranted = await _trackingApi.isAllRequiredPermissionsAndSensorsGranted();
copied to clipboard
Tracking status
final isTracking = await _trackingApi.isTracking();
copied to clipboard
Enable high-frequency data collection (HF)
We strongly recommend keeping it enabled by default
await _trackingApi.enableHF(value: true);
copied to clipboard
Create new tag
The detailed information about using Tags is available here
String tag = 'TAG';
String source = 'App';
await _trackingApi.addFutureTrackTag(tag: tag, source: source);
copied to clipboard
Remove a tag
String tag = 'TAG';
await _trackingApi.removeFutureTrackTag(tag: tag);
copied to clipboard
Remove all tags
await _trackingApi.removeAllFutureTrackTags();
copied to clipboard
Setting up the permission wizard
Without these permissions SDK can not be enabled.
If you want to use your own way to request permissions, you can skip this part.
To show the permission wizard, follow next steps:

Create and init StreamSubscription in your widget

late StreamSubscription<PermissionWizardResult?> _onPermissionWizardStateChanged;

@override
void initState() {
_onPermissionWizardStateChanged = _trackingApi
.onPermissionWizardClose
.listen(_onPermissionWizardResult);

void _onPermissionWizardResult(PermissionWizardResult result) {
if (result == PermissionWizardResult.allGranted) {
//All permissions are granted. To do something here.
} else {
//Permissions are not granted. To do something here.
}
}
copied to clipboard

Request to show the permission wizard

await _trackingApi.showPermissionWizard(
enableAggressivePermissionsWizard: false,
enableAggressivePermissionsWizardPage: true
);
copied to clipboard
If [enableAggressivePermissionsWizard] set to true the wizard will be finished if all required permissions granted (user can’t cancel it with back button), otherwise if set to false the wizard can be finished with not all granted permissions or cancelled with back button.
If [enableAggressivePermissionsWizardPage] set to true the wizard will slide to next page if requested permissions granted on current page, otherwise if set to false the wizard can slide with not granted permissions.
Available Methods (iOS only) #
Enable/Disable Automatic tracking
bool disableTracking = false;
//true to disable automatic tracking (tracking is enabled by default)
await _trackingApi.setDisableTracking(value: disableTracking);
copied to clipboard
Automatic tracking status
final isTrackingDisabled = await _trackingApi.isDisableTracking();
copied to clipboard
Enable/Disable Aggressive Heartbeats
The telematics SDK (iOS only) supports two operational modes for heartbeats;
Aggressive heartbeats - heartbeats are sent every 20 minutes. SDK is always active.
Normal Heartbeats - heartbeats are sent every 20 minutes but when SDK turns into Standby mode, it will be activated only by a new trip, and heartbeat will be sent respectively.
Mode switcher
bool enable = true; //false to disable aggressive heartbeats
await _trackingApi.setAggressiveHeartbeats(value: enable)
copied to clipboard
Check state
final isAggressiveHeartbeats = await _trackingApi.isAggressiveHeartbeat()
copied to clipboard
Enable Accidents detection
Accidents detection is disabled by default. You can enable detection.
In order for accidents detection to work, you need to enable high-frequency data collection
await _trackingApi.enableAccidents(value: true);

//to check current accidents status
final isEnabledAccidents = await _trackingApi.isEnabledAccidents();
copied to clipboard
Links #
https://damoov.com

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files:

Customer Reviews

There are no reviews.