Android
SDK Setup
Requirements
The SDK supports Android version 5.0 ("Lollipop", API level 21) or higher and the following ABIs:
armeabi-v7a
arm64-v8a
Integrating the SDK
Adding the dependencies using Maven
Specify the repositories in settings.gradle
(or in build.gradle
, if you are using an older version of Android Gradle plugin):
dependencyResolutionManagement {
repositories {
google()
mavenCentral()
maven {
url 'https://maven.navmii.com/artifactory/navmii-public'
credentials {
username "public"
password "public1&"
}
}
maven {
url 'https://repository.apache.org/content/repositories/snapshots/'
}
}
}
Add the following lines to your app's build.gradle
:
android {
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation 'com.navmii.android:dashcam-sdk:1.2.2.178'
}
If you want to always use the latest version of the SDK, you can specify a dynamic version instead of a fixed one. For example:
dependencies {
implementation 'com.navmii.android:dashcam-sdk:1.+'
}
Adding the dependencies as .aar files
To integrate the Dashcam SDK via AAR, ensure all required dependencies are included in your build.gradle file. The SDK does not bundle dependencies, so you must manually declare each.
Place the following AAR files in your libs/ folder and include them:
implementation(name: 'dashcamsdk-jio-release-Jio-1.0.0', ext: 'aar')
implementation(name: 'pathwayPro-jioSit-2.13.0.583', ext: 'aar')
implementation(name: 'recognizer-1.13.1', ext: 'aar')
The list of all the required dependencies:
implementation(name: 'dashcamsdk-jio-release-Jio-1.0.0', ext: 'aar')
implementation(name: 'pathwayPro-jioSit-2.13.0.583', ext: 'aar')
implementation(name: 'recognizer-1.13.1', ext: 'aar')
// Apache Commons Imaging
implementation 'org.apache.commons:commons-imaging:1.0-SNAPSHOT'
// JCodec
implementation 'org.jcodec:jcodec:0.2.1'
// OkHttp
implementation 'com.squareup.okhttp3:okhttp:4.9.2'
// Gson
implementation 'com.google.code.gson:gson:2.9.0'
// Room
implementation "androidx.room:room-runtime:2.5.0"
annotationProcessor "androidx.room:room-compiler:2.5.0"
// AutoValue
compileOnly "com.google.auto.value:auto-value-annotations:1.7"
annotationProcessor "com.google.auto.value:auto-value:1.7"
annotationProcessor 'com.ryanharter.auto.value:auto-value-parcel:0.2.6'
annotationProcessor "com.ryanharter.auto.value:auto-value-gson-extension:1.3.1"
implementation "com.ryanharter.auto.value:auto-value-gson-runtime:1.3.1"// Optional @GsonTypeAdapterFactory support
annotationProcessor "com.ryanharter.auto.value:auto-value-gson-factory:1.3.1"
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
api "androidx.documentfile:documentfile:1.0.1"
implementation "androidx.media:media:1.6.0"
implementation 'com.github.anastr:speedviewlib:1.5.4'
implementation 'com.jakewharton.timber:timber:5.0.1'
// region glide (for thumbnails)
implementation 'com.github.bumptech.glide:glide:4.14.2'
annotationProcessor 'com.github.bumptech.glide:compiler:4.14.2'
Adding API Key to the Manifest
Add the following lines to the AndroidManifest.xml
of your application within the <application></application>
block:
<meta-data android:name="com.navmii.sdk.API_KEY" android:value="<YOUR_API_KEY>" />
Setting the permissions
Add the following lines to the AndroidManifest.xml
within the <manifest></manifest>
block:
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-feature android:glEsVersion="0x00020000" android:required="true" />
<uses-feature android:name="android.hardware.camera" android:required="true" />
<uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
<uses-feature android:name="android.hardware.location.gps" android:required="true" />
If you want to record audio, also add the following permission:
<uses-permission android:name="android.permission.RECORD_AUDIO" />
Initializing the SDK
After requesting the required permissions from user as described here, you can initialize the SDK using initSdkAsync
method:
...
val requestPermissionLauncher =
registerForActivityResult(
ActivityResultContracts.RequestMultiplePermissions()
) { result: Map<String, Boolean> ->
for ((permission, isGranted) in result) {
if (!isGranted) {
return@registerForActivityResult
}
}
val settings = DashcamSdk.ConfigurationSettings.builder()
.setLibraryLocation(DocumentFile.fromFile(getExternalFilesDir(null)!!))
.build()
DashcamSdk.getInstance().addStateChangeListener { state ->
Log.d("MainActivity", "SDK state: $state, error: ${DashcamSdk.getInstance().initializationError}")
}
DashcamSdk.getInstance().initSdkAsync(this, settings)
}
...
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
...
requestPermissionLauncher.launch(arrayOf(
Manifest.permission.CAMERA,
Manifest.permission.ACCESS_FINE_LOCATION))
}
API Reference
Please follow the link below for the API reference
https://navmii-api-reference.s3.eu-west-1.amazonaws.com/dashcam-sdk/Android/1.2.2.178/index.html