收藏
回答

搜索蓝牙设置了allowDuplicatesKey: false不允许重复上报,苹果手机无效?

搜索附近蓝牙设备设置了不允许重复上报,wx.onBluetoothDeviceFound在苹果14依然上报了重复的设备,华为上正常

wx.startBluetoothDevicesDiscovery({

            allowDuplicatesKey: false, //不允许重复上报

            // services: [''],//指定services搜索 0000ffe0-0000-1000-8000-00805f9b34fb

            success: function (res) {

              console.log("开始搜索附近蓝牙设备")

              that.setData({

                searchingstatus: true,

                disabled: true,

              })

              that.onBluetoothDeviceFound()

 onBluetoothDeviceFound() {

    wx.onBluetoothDeviceFound((res) => {

      res.devices.forEach(device => {

        this.data.devices.push(device)

        this.setData({ devices: this.data.devices })

      })

    })

  },


回答关注问题邀请回答
收藏

2 个回答

  • 风的气味
    风的气味
    2023-08-04

    解决了不????

    2023-08-04
    有用
    回复
  • 奋斗吧小青年°
    奋斗吧小青年°
    2023-05-17

    这好正常哦。ios有自己的算法

    2023-05-17
    有用
    回复
登录 后发表内容