blueToothEnable 打开手机蓝牙开关

blueToothEnable ^7.6.0

打开手机蓝牙开关

#请求参数

  • N/A

#接口调用示例

this.$bridge
    .blueToothEnable ()
    .then(res => {    
    this.$alert(res)
    })
    .catch(err => {
    this.$toast(err)
    })

#返回参数

  • 各系统按照目前定义的标准打开流程处理
// 设备状态推送,返回数据格式:
{ 
    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)
        }
    })
}
.....
}

WARNING

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

posted on 2024-12-16 09:43  AtlasLapetos  阅读(14)  评论(0)    收藏  举报