小程序android平台蓝牙发现不到设备

微信小程序,微信公开课,小程序android平台蓝牙发现不到设备 微信公开课

如何看待微信公开课小程序热门讨论「小程序android平台蓝牙发现不到设备」
摘要:小程序android平台蓝牙发现不到设备
展开:我在定时器里面间隔5秒开始一次发现蓝牙设备,然后关闭发现蓝牙设备,在ios平台,每次都可以正常的有wx.onBluetoothDeviceFound()回调。但是在android(三星S7)平台上wx.onBluetoothDeviceFound,没有被回调。我不知道什么情况。代码如下:rssi_timer_cb是间隔5秒的定时器函数,求解,谢谢。423wx.onBluetoothDeviceFound(function(res){424varrssi_flagfalse;425varrssi_val0;426//console.log(res);427//console.log(rssi_name:+that.le_devicename);428for(varx0;xres.devices.length;x++){429if(res.devices[x].namethat.le_devicenamerssi_flagfalse){430rssi_valres.devices[x].RSSI;431rssi_flagtrue;432}433}434435if(rssi_flagtrue){436wx.stopBluetoothDevicesDiscovery({437success:function(res){438console.log(res);439},440441fail:function(res){442console.log(res);443},444445complete:function(res){446rssi_findfalse;447callback(le.prototype.SUCC,rssi_val);448},449});450}451else{452//callback(le.prototype.ERR_RSSI_OUT,rssi_val);453//callback(56,rssi_val);454}455456});460functionrssi_timer_cb(){461if(that.connect_statetrue){462console.log(RSSI已连接);463varrssi_gffalse;464varrssi_gv0;465wx.getBluetoothDevices({466success:function(res){467console.log(res);468for(vari0;ires.devices.length;i++){469if(res.devices[i].namethat.le_devicenamerssi_gffalse){470rssi_gvres.devices[i].RSSI;471rssi_gftrue;472}473}474if(rssi_gftrue){475callback(le.prototype.SUCC,rssi_gv);476}477else{478callback(le.prototype.ERR_RSSI_OUT,rssi_val);479}480},481482fail:function(res){483console.log(res);484},485});486}487else488{489//console.log(RSSI未连接delay:+delay);490le.prototype.open_adapter(callback_open_adapter,that);491functioncallback_open_adapter(ret_msg){492if(ret_msgle.prototype.SUCC){493//that.rssi_timersetInterval(rssi_timer_cb,delay);494//console.log(startrssitimer+delay++that.rssi_timer);495//functionrssi_timer_cb(){496if(rssi_findtrue){497//callback(le.prototype.ERR_RSSI_OUT,rssi_val);498console.log(findopen!);499wx.stopBluetoothDevicesDiscovery({500success:function(res){501console.log(res);502503varopen_timersetTimeout(open_timeout_bc,200);504functionopen_timeout_bc(){505wx.startBluetoothDevicesDiscovery({506allowDuplicatesKey:false,507//interval:4000,508success:function(res){509console.log(res);510rssi_findtrue;511},512513fail:function(res){514},515516complete:function(res){517},518});519clearTimeout(open_timer);520}521},523fail:function(res){524console.log(res);525},526});527}528else{529console.log(findclose!);530wx.startBluetoothDevicesDiscovery({531allowDuplicatesKey:false,532//interval:4000,533success:function(res){534console.log(res);535rssi_findtrue;536},537538fail:function(res){539},540});541}542543wx.onBluetoothAdapterStateChange(function(res){544console.log(adapterStatechanged,nowis,res);545if(res.availablefalse){546wx.showModal({547title:提示,548showCancel:false,549content:请检查手机蓝牙是否打开,550});551}552else{553}554});555}556else{557callback(ret_msg,0);558}559}了解更多

「小程序android平台蓝牙发现不到设备」热门讨论订阅

微信小程序,微信公开课,小程序android平台蓝牙发现不到设备
订阅小程序

方法1:微信扫描微信公开课小程序码即可订阅热门讨论「小程序android平台蓝牙发现不到设备」

方法2:微信搜索微信公开课小程序名称进入,即可订阅热门讨论「小程序android平台蓝牙发现不到设备」

方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热门讨论「小程序android平台蓝牙发现不到设备」

微信公开课小程序热门讨论「小程序android平台蓝牙发现不到设备」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。

微信公开课热门讨论「小程序android平台蓝牙发现不到设备」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。