企业微信wx.openBluetoothAdapter Android 没有此方法? ios正常
发布于 6 年前 作者 xiuying09 2498 次浏览 来自 官方Issues

企业微信最新版

使用场景: 企业微信通过蓝牙接口  调用打印机

问题: wx 对象没有openBluetoothAdapter 方法 基本上蓝牙相关的都没有

ios 是正常的

3 回复

您好,js是怎么引用的呢,能否贴下出来看看呢,或者关掉X5内核调试下是否还有提示没有此方法呢

你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html

机型: OPPO R9sk

Android 版本: 6.0.1

企业微信版本: 2.8.12

wx.ready(() => {
     wx.openBluetoothAdapter({
       success: () => {
         wx.getBluetoothAdapterState({
           success: (res) => {
             if (res.available) {
               wx.startBluetoothDevicesDiscovery({
                 success: () => {
                   this.timer = setInterval(() => {
                     wx.getBluetoothDevices({
                       success: ({ devices }) => {
                         console.log(devices);
                         if (Array.isArray(devices) && devices.length > 0) {
                         // console.log(ab2hex(devices[0].advertisData));
                           this.devices = devices
                             .filter(v => !!v.name)
                             .reduce((p, n) => ({ ...p, [n.name]: n }), {});
                         }
                       },
                     });
                   }, 3000);
                 },
               });
             }
           },
         });
       },
     });

undefined not functuion

猜测wx 上未绑定openBluetoothAdapter 方法

回到顶部