Last Updated on : 2024-06-24 08:06:51download
The device pairing service in the BizBundle SDK is encapsulated and extended on top of the Smart Life App SDK. It simplifies the pairing process and improves the reusability of code. Informative pairing status callbacks and error codes enable real-time monitoring of the pairing process and effective troubleshooting.
The device pairing service provides unified and parallel device searching and activation services. It supports the following capabilities:
The class ThingActivatorCoreKit
provides APIs for the device pairing service, with scanning for nearby devices and pairing devices at the core.
//Scan for nearby devices
val scanManager = ThingActivatorCoreKit.getScanDeviceManager()
//Pair a discovered device
val activeManager = ThingActivatorCoreKit.getActiveManager().newThingActiveManager()
For the supporting features, check the code comments.
Error codes | Reason |
---|---|
10002 | Invalid parameter. |
DEVICE_ALREADY_BIND | Strong binding error. The device is already bound with a user. Pairing can work only after the device is unbound from the current user. |
GUEST_NOT_SUPPORT_STRONG_BIND | A guest account is not allowed to pair a device of strong binding. |
For Android 12 and later:
usesPermissionFlags
attribute to your Bluetooth scan permission declaration, and set this attribute’s value to neverForLocation
. For more information, see the official Android documentation Bluetooth permissions.To scan for iBeacon broadcast signals, you still need to request the location permissions.
If your app is not used to control iBeacon devices, you only need to request Bluetooth-specific permissions.
Beacons such as iBeacon are filtered from the scan results when including the neverForLocation
flag.
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"
android:usesPermissionFlags="neverForLocation"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
If your app is used to control iBeacon devices, you need to request the location permissions and not include the neverForLocation
flag.
<uses-permission android:name="android.permission.BLUETOOTH_SCAN"/>
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADVERTISE"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback