Smart Lock SDK

Last Updated on : 2024-01-09 01:50:40download

Smart Lock SDK for Android encapsulates the APIs to communicate with smart locks over Bluetooth and Wi-Fi and accelerates lock app development. The SDK supports the following features:

  • Lock user system: manage lock users and associated passwords
  • Unlocking with passwords: get dynamic passwords and manage temporary passwords
  • Lock usage records: unlocking records, doorbell records, and alerts

The SDK is currently available in preview, being continuously optimized. If you have any problems or suggestions about the SDK, submit a ticket to request technical support.

Before you start

The Smart Lock SDK serves your development as an extension of Smart Life App SDK. For more information, see Preparation.

Integrate with the SDK

Add a dependency

Add the following dependency to the file build.gradle of module:

dependencies {
    ...
   implementation 'com.tuya.smart:tuyasmart-lock-sdk:2.2.0-cube.2'
}

In order to use the audio and video capabilities, you need to integrate the IPC SDK separately.

Add permissions

To scan and connect to Bluetooth devices, add the following permissions to AndroidManifest.xml. These permissions do not apply to non-Bluetooth devices.

<!-- 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" />

For more information about dynamic permissions, see Android’s document Request app permissions.