scope列表中找不到scope.bluetooth?

发布于 7 年前作者 aliang10415 次浏览最后编辑 7 年前来自 ask

scope列表中怎么找不到scope.bluetooth这一个,接口调整公告里面说的以后调用蓝牙,需要先授权scope.bluetooth

2 回复
qiang26
qiang261 楼4 年前

逻辑大概是:你可以通过 wx.getSetting 获取 scope.bluetooth 是否为 true 代表授权状态

如果 wx.getSetting 里没有 scope.bluetooth ,则要用 wx.authorize({ scope: "scope.bluetooth" }) 去弹窗要求用户授权

如果 wx.getSetting 里有 scope.bluetooth 并且为 false,则要用 wx.openSetting 引导用户手动开启授权开关。