scope列表中找不到scope.bluetooth?
发布于 5 年前 作者 aliang 10205 次浏览 来自 问答

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

2 回复

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

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

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

回到顶部