Integration Guide
This part is introducing how to integrate the Android SDK
You need to download the latest SDK simple to continue.
Run the demo directly
After downloading the SDK demo source code, it can be run independently. It comes with test forensic information and tickets by default.
Integrating SDK into existing projects
Import aar package
From version 3.0, SDK aar package is name libBosmaSdk_v3.xx.xx.aar
.
-
Copy
libBosmaSdk_v3.xx.xx.aar
to libs folder of your project。 -
Add the following code to module
build.gradle
:
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar', '*.aar'])
implementation(name: 'libBosmaSdk_V3.0.1', ext: 'aar') //replace the real version when needed
}
Permissions Configuration
-
Add the following permissions to
AndroidManifest.xml
.//Network <uses-permission android:name="android.permission.INTERNET" /> //SDCard permission <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> //audio permission <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> //BLE permission <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.BLUETOOTH" /> <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
Config secret keys
The secret keys applies will be set into AndroidManifest.xm
l
<meta-data android:name="com.bosma.appsecret" android:value="xxxx" />
<meta-data android:name="com.bosma.company" android:value="xxxx" />
<meta-data android:name="com.bosma.appid" android:value="xxxx" />
Add Dependency Libraries
In module build.gralde
, add the following libraries:
// Retrofit & OKHttp
implementation("com.squareup.retrofit2:retrofit:2.9.0")
implementation("com.squareup.retrofit2:converter-gson:2.9.0")
implementation("com.squareup.okhttp3:okhttp:4.2.0")
implementation("com.squareup.okhttp3:logging-interceptor:4.2.0")
//RxAndroidBle
implementation "com.polidea.rxandroidble2:rxandroidble:1.11.1"
implementation "io.reactivex.rxjava2:rxandroid:2.1.1"
implementation "io.reactivex.rxjava2:rxjava:2.2.17"
implementation "com.jakewharton.rxrelay2:rxrelay:2.1.1"
implementation "com.jakewharton.rx2:replaying-share:2.2.1"
//Gson
implementation "com.google.code.gson:gson:2.8.6"
//MMKV
implementation "com.tencent:mmkv-static:1.2.9"