抖音开放平台Logo
开发者文档
“/”唤起搜索
控制台

tt.stopBluetoothDevicesDiscovery

收藏
我的收藏

基础库 1.0.0 开始支持本方法,这是一个异步方法。

停止搜寻附近的蓝牙外围设备。

前提条件无
业务背景无
使用限制无
注意事项
1. 在找到目标设备后应立即调用此接口停止搜索,以节省系统资源。 2. 即使未调用tt.startBluetoothDevicesDiscovery,也可以调用此接口。
支持沙盒
否
相关教程无

语法

tt.stopBluetoothDevicesDiscovery(options)

参数说明

options 为 object 类型,属性如下:

属性名类型默认值必填说明最低支持版本
successfunction否
接口调用成功的回调函数
1.0.0
failfunction否
接口调用失败的回调函数
1.0.0
completefunction否
接口调用结束的回调函数(调用成功、失败都会执行)
1.0.0

回调成功

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"stopBluetoothDevicesDiscovery:ok"
3.87.0
errorCodestring
错误码信息
3.87.0

回调失败

object 类型,属性如下:

属性名类型说明最低支持版本
errMsgstring
"stopBluetoothDevicesDiscovery:fail" + 详细错误信息
3.87.0
errorCodestring
错误码信息
3.87.0

错误码

errorCodeerrMsgerrorType说明最低支持版本
187101stopBluetoothDevicesDiscovery:fail not initD
未初始化蓝牙适配器
3.87.0
187102stopBluetoothDevicesDiscovery:fail adapter not availableF
小程序框架内部错误,有需要请创建工单咨询
3.87.0
187109stopBluetoothDevicesDiscovery:fail system errorF
小程序框架内部错误,有需要请创建工单咨询
3.87.0

代码示例

开发者工具中预览

tt.stopBluetoothDevicesDiscovery({ success(res) { console.log(res) } })