收藏
回答

体验版本的蓝牙可以使用,体验版发布后,发布版本的无法使用?



startBluetoothDevicesDiscovery() {

    var that = this;

    if (this._discoveryStarted) {

      this.stopBluetoothDevicesDiscovery()

      return

    }

    this.setData({ misScanding: true,

    scandbutName: "正在搜索,点击停止",

      devices: [],

      chs: [],

    })

    //console.log('lisn3188---------- misScanding = ', this.misScanding)

    this._discoveryStarted = true

    wx.startBluetoothDevicesDiscovery({

      allowDuplicatesKey: true,

      success: (res) => {

        setTimeout(function () {

          console.log("----BluetoothDevicesDiscovery finish---- ");

          if (that._discoveryStarted){

            that.stopBluetoothDevicesDiscovery()

          }

        }, 20000);

        console.log('startBluetoothDevicesDiscovery success', res)

        this.onBluetoothDeviceFound()

      },

    })

  },

  stopBluetoothDevicesDiscovery() {

    this._discoveryStarted = false

    wx.stopBluetoothDevicesDiscovery()

    this.setData({ misScanding: false, scandbutName:"重新刷新列表", })

    //console.log('lisn3188---------- misScanding = ', this.misScanding)

  },

  onBluetoothDeviceFound() {

    wx.onBluetoothDeviceFound((res) => {

      res.devices.forEach(device => {

        if (!device.name && !device.localName) {

          return

        }

        const foundDevices = this.data.devices

        const idx = inArray(foundDevices, 'deviceId', device.deviceId)

        const data = {}

        if (idx === -1) {

          data[`devices[${foundDevices.length}]`] = device

        } else {

          data[`devices[${idx}]`] = device

        }

        this.setData(data)

      })

    })

  },

体验版点击这个按钮可以搜索到蓝牙设备,发布后,点击没有任何反应了

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

2 个回答

  • 那一抹微笑😊穿透阳光
    那一抹微笑😊穿透阳光
    2025-12-01

    发布版本的时候,从这个地方进入,完善一下用户隐私保护协议,看一下有没有蓝牙的,没有就点击更多类型添加上

    2025-12-01
    有用
    回复
  • 智能回答 智能回答 本次回答由AI生成
    2025-12-01
    有用
登录 后发表内容