...
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
In order to add the SDK library to your application insert the following code into your app's build.gradle
Specify the repositories in settings.gradle
(or in build.gradle
, if you are using an older version of Android Gradle plugin):
Code Block | ||
---|---|---|
| ||
androiddependencyResolutionManagement { compileOptions { sourceCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8 } } repositories { maven { url 'httphttps://spbmaven.navmii.com:8081/artifactory/navmii-public' credentials { username "public" password "public1&" } } maven { url 'https://repository.apache.org/content/repositories/snapshots/' } } dependencies {} |
Add the following lines to your app's build.gradle
:
Code Block | ||
---|---|---|
| ||
android { compileOptions { compile ('com.navmii.android:dashcam-sdk:1.1.3-72@aar') { transitive = true }// 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:
Code Block | ||
---|---|---|
| ||
dependencies { compileimplementation ('com.navmii.android:dashcam-sdk:1.+@aar') { transitive = true } } |
Adding API Key to the Manifest
...
Code Block | ||
---|---|---|
| ||
<uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGEINTERNET" /> <uses-permission android:name="android.permission.INTERNETACCESS_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" /> |
...
Code Block | ||
---|---|---|
| ||
<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:
Code Block | ||
---|---|---|
| ||
... 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
httphttps://spb.navmiinavmii-api-reference.s3.eu-west-1.amazonaws.com/dashcam-SDKsdk/android/javadoc/Android/1.2.2.178/index.html
...