- 在断开蓝牙设备后,我会收到断开回调。但有时仍然无法断开连接。在某些层面上,连接状态仍然保持着,因此我无法重新连接。
我已经在Android 5和Android 6中进行了测试。 在HTC One A9、Moto X Play和Moto G4上。
- 如果我打开关闭蓝牙,则再次收到断开回调,实际上设备正在断开连接。 -请提供一些解决该问题的建议。
- 我正在执行以下步骤进行BLE操作
- 1.发现BLE设备。
- 连接到设备。
- 在onConnectionStateChange(connected)中,我正在执行gatt.discoverServices()
- 在onServicesDiscovered回调中,我正在读取特征 5.onCharacteristicRead回调中,我正在写入特征。 6.onCharacteristicWrite回调中,我正在执行gatt.disconnect()
- 在onConnectionStateChange(disconnected)中,我正在执行gatt.close()
在整个过程中,后台正在进行设备扫描。