z***@163.com
z***@163.com
  • 发布:2023-03-14 16:30
  • 更新:2023-03-29 11:49
  • 阅读:296

uni打包之后,低耗能蓝牙一直提示超时,状态码10012

分类:uni-app

在本地正式调试的时候是可以进到success的值中的,deviceid打印也是有值的,但是打包发布之后,就一直进到fail里面,提示createBLEConnection:fail operate time out, 状态码10012

 uni.createBLEConnection({  
                // 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接  
                deviceId: that.deviceId,  
                success(res) {  
                    console.log(res)  
                    uni.hideLoading()  
                    that.linkName = name;  
                    console.log('连接成功---', "Bluetooth," + that.deviceId)  
                    let code = HPRTPrinterHelper.PortOpen("Bluetooth," + that.deviceId);  
                    that.$refs.myTipsPop.showTipsPop(true, 'success', '连接成功');  
                    console.log(code)  
                    uni.setStorageSync('content_bluetooth', that.deviceId)  
                    uni.setStorageSync('content_bluetoothname', that.linkName)  
                    uni.getConnectedBluetoothDevices({  
                        success(res) {  
                            console.log(res)  
                        }  
                    })  
                },  
                fail(res) { //如果手机上的蓝牙没有打开,可以提醒用户  
                    uni.hideLoading()  
                    that.$refs.myTipsPop.showTipsPop(true, 'errortoast', '连接失败');  
                    console.log(res, "11111111")  
                }
2023-03-14 16:30 负责人:DCloud_Android_zl 分享
已邀请:
DCloud_App_Array

DCloud_App_Array

确认有没有配置蓝牙权限

要回复问题请先登录注册