SDK 集成

更新时间:2024-04-26 09:38:09下载pdf

准备工作

该 SDK 依赖于涂鸦智能生活 SDK,基于此基础上进行拓展开发。更多详情,请参考 准备工作

快速集成

添加依赖

在 module 层的 build.gradledependencies 中,添加门锁 SDK 依赖:

dependencies {
    ...
   implementation 'com.thingclips.smart:thingsmart-lock-sdk:5.1.1'
}

权限说明

为了扫描和连接蓝牙设备,您需要添加下列权限到 AndroidManifest.xml 中,非蓝牙设备可忽略。

<!-- Required. Allows applications to connect to paired bluetooth devices.  -->
<uses-permission android:name="android.permission.BLUETOOTH" />
<!-- Required. Allows applications to discover and pair bluetooth devices.  -->
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<!-- Required.  Allows an app to scan bluetooth device.  -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<!-- Required.  Allows an app to scan bluetooth device.  -->
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!--  Allows an app to use bluetooth low energy feature  -->
<uses-feature
android:name="android.hardware.bluetooth_le"
android:required="false" />

有关动态权限获取,请参考安卓官方文档 请求运行时权限