收藏
回答

BLE APIs在真机上获取不到advertisData









wx.openBluetoothAdapter({

    success: function () {


    var scaning = true;

    wx.onBluetoothDeviceFound(function (res) {

        console.log(res)

        for (var d in res.devices) {

            console.log('advertisData:'+d.advertisData)

            console.log(typeof d.advertisData)

        }

    });

    

    setTimeout(function () {

        if (scaning) {

            console.warn("ble搜索超时,停止搜索")

            wx.stopBluetoothDevicesDiscovery()

            fail()

        }

    }, 10 * 1000);

    

    wx.startBluetoothDevicesDiscovery({

        services: ['18EE'],

        allowDuplicatesKey: true,

        success: function (res) {

            console.log(res)

        }

        })

    }, fail: function (e) {

        fail(e)

    }

})



用第三方工具扫描蓝牙,是能看到广播数据的(第二张图);

分别使用Android和iOS测试过小程序,都获取不到;

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

1 个回答

  • sh4wn
    sh4wn
    2017-10-09

    有人遇到相同的问题吗?

    2017-10-09
    有用
    回复 2
    • 2018-09-03

      你好,请问你这个问题解决了吗


      2018-09-03
      回复
    • 吾往矣
      吾往矣
      2020-07-29
      挖坟同问
      2020-07-29
      回复
登录 后发表内容