Skip to main content
Version: 3.x

Taro.getConnectedBluetoothDevices(option)

Gets devices in the connected status based on the UUIDs.

Reference

Type

(option: Option) => void

Parameters

Option

PropertyTypeRequiredDescription
servicesstring[]YesThe list of primary service UUIDs of Bluetooth devices
complete(res: any) => voidNoThe callback function used when the API call completed (always executed whether the call succeeds or fails)
fail(res: any) => voidNoThe callback function for a failed API call
success(res: Result) => voidNoThe callback function for a successful API call

SuccessCallbackResult

PropertyTypeDescription
devicesBluetoothDeviceInfo[]The list of discovered devices
errMsgstringsuccess: ok; fail: error message.

BluetoothDeviceInfo

PropertyTypeDescription
deviceIdstringDevice ID
namestringThe name of the Bluetooth device. Some devices may not have a name.

Sample Code

Taro.getConnectedBluetoothDevices({
success: function (res) {
console.log(res)
}
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getConnectedBluetoothDevices✔️