Skip to content
Kilnn edited this page Jan 30, 2023 · 23 revisions

FitCloudSDK is a BLE library to scan/connect FitCloud device.

The main responsibility of this library is to interact with FitCloud devices in accordance with the protocol.

This document guides Android developers to integrate FitCloudSDK in Android 4.4 and above.

1.Import SDK

dependencies {
    //Required
    implementation files('../aar/libraryCore_v2.0.0-alpha02.00.aar')
    implementation files('../aar/libraryProtocol2_v2.0.0-alpha02.00.aar')
    implementation "org.jetbrains.kotlin:kotlin-stdlib:1.7.20"
    implementation "androidx.core:core-ktx:1.9.0"
    implementation "androidx.annotation:annotation:1.5.0"
    implementation "com.jakewharton.timber:timber:5.0.1"
    implementation "io.reactivex.rxjava3:rxjava:3.1.5"
    implementation  "io.reactivex.rxjava3:rxandroid:3.0.2"
    implementation "com.polidea.rxandroidble3:rxandroidble:1.17.2"

    //Optional. Dfu function for Realtek chip
    implementation files('../aar/libraryDfu8762C_v2.0.0-alpha02.00.aar')
    //Optional. Dfu function for Nordic chip
    implementation 'no.nordicsemi.android:dfu:2.2.2'
    //Optional. Download files for Dfu function.
    implementation 'com.squareup.okhttp3:okhttp:4.10.0'
    //Optional. Built-in music control function
    implementation 'androidx.media:media:1.6.0'

    //Optional. Some APIs compatible with 1.x.x are provided to minimize changes during migration.
    implementation files('../aar/libraryCompat2_v2.0.0-alpha02.00.aar')
}

2.Permission

Refer to RxAndroidBLE

Although BLUETOOTH and BLUETOOTH_ADMIN permissions are replaced by BLUETOOTH_SCAN and BLUETOOTH_CONNECT permissions in Android 12 and above. But some Android 12 systems still need to add two permissions, like this:

<uses-permission
        android:name="android.permission.BLUETOOTH"
        tools:node="replace"/>
<uses-permission
        android:name="android.permission.BLUETOOTH_ADMIN"
        tools:node="replace"/>

3.Initialize

Clone this wiki locally