部分代码:
wx.startBeaconDiscovery({
//fda50693-a4e2-4fb1-afcf-c6eb07647825,fda50693-a4e2-4fb1-afcf-c6eb07647825,12345678-9012-3456-7890-123456789012
uuids:['fda50693-a4e2-4fb1-afcf-c6eb07647002','fda50693-a4e2-4fb1-afcf-c6eb07647003','fda50693-a4e2-4fb1-afcf-c6eb07647004','fda50693-a4e2-4fb1-afcf-c6eb07647005'],
success: function (res) {
console.log("开始扫描设备...",res);
// 监听iBeacon信号
wx.onBeaconUpdate(function (res) {
console.log("开始监听~");
if (res && res.beacons && res.beacons.length > 0) {
// 此处最好检测rssi是否等于0,等于0的话信号强度等信息不准确。我是5秒内重复扫描排重。
console.log("当前监听到:",res.beacons);
//this.devices = res.beacons;