# blueToothEnable ^7.6.0

打开手机蓝牙开关

# 请求参数

  • N/A

# 接口调用示例


this.$bridge
    .blueToothEnable ()
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })
1
2
3
4
5
6
7
8
9

# 返回参数

  • 各系统按照目前定义的标准打开流程处理

// 设备状态推送,返回数据格式:
{ 
    messageType: "bluetoothEnable",
    messageBody: { status: 1 } 
}

const globalEvent = weex.requireModule('globalEvent')
 
export default {
.....   
created() {
    // 监听设备状态推送
    globalEvent.addEventListener('receiveMessageFromApp', (response) => {
        // 业务逻辑
        let { messageType, messageBody } = response
        if (messageType == 'bluetoothEnable'){
            console.log(messageBody)
        }
    })
}
.....
}

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

WARNING

该接口仅可在android设备上使用,ios因为权限问题不适用

Last Updated: 6/16/2021, 2:02:29 PM