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

tt.closeBluetoothAdapter

收藏
我的收藏

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

关闭本机蓝牙模块。

前提条件无
业务背景无
使用限制无
注意事项
1. 调用此接口会断开所有已建立的蓝牙连接,释放系统资源。 2. 建议在不需要使用蓝牙时及时调用此接口,以减少电量消耗。
支持沙盒
否
相关教程无

语法

tt.closeBluetoothAdapter(options)

参数说明

options 为 object 类型,属性如下:

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

回调成功

object 类型,属性如下:

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

回调失败

object 类型,属性如下:

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

错误码

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

代码示例

开发者工具中预览

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