if(device==null){
main = plus.android.runtimeMainActivity();
BluetoothAdapter = plus.android.importClass("android.bluetooth.BluetoothAdapter");
UUID = plus.android.importClass("java.util.UUID");
uuid = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
BAdapter = BluetoothAdapter.getDefaultAdapter();
device = BAdapter.getRemoteDevice(mac_address);
plus.android.importClass(device);
bluetoothSocket = device.createInsecureRfcommSocketToServiceRecord(uuid);
plus.android.importClass(bluetoothSocket);
}
if (!bluetoothSocket.isConnected()) {
console.log('检测到设备未连接,尝试连接....');
bluetoothSocket.connect();
}
尝试连接蓝牙时,会报错Uncaught java.io.IOException: read failed, socket might closed or timeout, read ret: -1;at android.bluetooth.BluetoothSocket.connect at index.html:1,经搜集资料可能时蓝牙版本问题。不知道有什么方法可以解决。请各位朋友指点。谢谢!
1***@qq.com
- 发布:2018-01-31 14:56
- 更新:2019-06-24 14:04
- 阅读:3262
3 个回复
lee60
我也需要ble的解决方法,论坛里现在都是4.0以下的方式,感觉要放弃Dcloud了
q***@163.com
有解吗?同样问题。。。求解。
Viccy
请问问题解决了吗?