当前位置:网站首页>uniapp 判断用户蓝牙是否打开
uniapp 判断用户蓝牙是否打开
2022-07-21 05:06:00 【走向大前端】
先初始化蓝牙模块:
uni.openBluetoothAdapter()
然后判断是否打开蓝牙
/* 判断是否打开蓝牙 */
uni.getBluetoothAdapterState({
success(res) {
//如果res.avaliable==false 说明没打开蓝牙 反之则打开
if(res.available==false){
uni.$u.toast("请打开蓝牙")
return
}else{
//这里是我的业务
/* 设置防护模式 */
this.setTerminalMode({
workMode: 1
}, 0)
}
}
})
边栏推荐
猜你喜欢
随机推荐
In the fourth game, where is the restaurant? Shepherd boy points to Xinghua village from afar and matches several to relieve the pressure on the line
Jump and receive parameters of JS page
js运行机制
第五局 阿卡丽教学局 上
14.【string函数上章】
js动态实现倒计时功能
Deep analysis of string -- strlen & strtok
C. Binary string (prefix sum)
不拉扯了 不拉扯了 碎碎念 下
In the fourth game, where is the restaurant? Shepherd boy points to Xinghua village
Codeforces 1642B Power Walking
在控制台输出语句
12.【I/O流get()与getline()与put()函数】
2020 Changzhou programming expert real problem and solution
Don't pull it today, don't pull it, read it in pieces
蛇形数字宫格的实现. 编写一个cube函数,入参为num, 通过js实现 要求如下:当num=3时,输出表格效果为:[[1,2,3][6,5,4][7,8,9]]
Record some little cheese about writing the program ~ [continue to be more ~]
Simpledateformat is used correctly
uni-app 新建报错 Cannot read property mode of undefined
$.each的用法