f***@163.com
f***@163.com
  • 发布:2018-04-13 15:39
  • 更新:2018-05-25 13:30
  • 阅读:2742

mui蓝牙连接不稳定(有偿)

分类:MUI

搜索蓝牙速度太慢,有时候搜不到蓝牙,哪位大神能帮忙解决一下,有偿的,代码如下:
main = plus.android.runtimeMainActivity();
BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
BAdapter = BluetoothAdapter.getDefaultAdapter();
BluetoothDevice = plus.android.importClass('android.bluetooth.BluetoothDevice');
BAdapter.startDiscovery()
var foundreceiver = plus.android.implements('io.dcloud.android.content.BroadcastReceiver', {
onReceive: function(context, intent) {
plus.android.importClass(intent);
console.log(intent.getAction());
var BleDevice = new BluetoothDevice();
BleDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
console.log("蓝牙设备:" + BleDevice.getName() + BleDevice.getAddress());
}
});

            var IntentFilterScan = plus.android.importClass('android.content.IntentFilter');  
            var filterScan = new IntentFilterScan();  
            filterScan.addAction(BluetoothDevice.ACTION_FOUND); //搜索设备                    
            main.registerReceiver(foundreceiver, filterScan); //注册监听
2018-04-13 15:39 负责人:无 分享
已邀请:
喜洋洋liugp

喜洋洋liugp

你好 这个不一定是代码的问题 也有可能是mui调用原生安卓的速度慢

该问题目前已经被锁定, 无法添加新回复