gpt4 book ai didi

断开连接后,Android BLE 在后台连接

转载 作者:行者123 更新时间:2023-11-29 02:40:22 27 4
gpt4 key购买 nike

我们正在使用 RxAndroidBle 1.3.1 从 Android 连接到 BLE 设备。在某些手机上(目前我在 LG V20 [LG-H918]、Android 7.0 上看到了这一点),在我们的应用程序断开连接后,手机将继续连接而无需任何用户输入。

当我们关闭我们的应用程序时,设备会断开连接。然后我们可以杀死我们的应用程序进程。大约 20 秒后,手机重新连接到设备约 2 秒,然后断开连接。这种行为每 10-20 秒无限重复一次,直到我们重新启动手机。

实际上,如果我们在连接仍然存在的情况下硬终止应用程序,我们甚至可以获得重复连接。

这些是我们断开连接时的日志:

06-21 10:51:07.464 26640-26640/com.hatchbaby.rest.qa I/Nightlight: [main] Disconnecting: Nightlight.disconnect()
06-21 10:51:07.528 26640-26640/com.hatchbaby.rest.qa D/BluetoothGatt: setCharacteristicNotification() - uuid: 02240003-5efd-47eb-9c1a-de53f7a2b232 enable: false
06-21 10:51:07.538 26640-26640/com.hatchbaby.rest.qa D/RxBle#Radio: QUEUED RxBleRadioOperationDescriptorWrite(131621266)
06-21 10:51:07.539 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: STARTED RxBleRadioOperationDescriptorWrite(131621266)
06-21 10:51:07.543 26640-26640/com.hatchbaby.rest.qa D/BluetoothGatt: setCharacteristicNotification() - uuid: 02260002-5efd-47eb-9c1a-de53f7a2b232 enable: false
06-21 10:51:07.547 26640-26640/com.hatchbaby.rest.qa D/RxBle#Radio: QUEUED RxBleRadioOperationDescriptorWrite(250764313)
06-21 10:51:07.548 26640-26640/com.hatchbaby.rest.qa D/RxBle#Radio: QUEUED RxBleRadioOperationDisconnect(160892126)
06-21 10:51:07.562 26640-26640/com.hatchbaby.rest.qa I/Nightlight: [main] Nightlight state: RxBleConnectionState{DISCONNECTED}
06-21 10:51:07.686 26640-26747/com.hatchbaby.rest.qa D/RxBle#BluetoothGatt: onDescriptorWrite descriptor=00002902-0000-1000-8000-00805f9b34fb status=0
06-21 10:51:07.688 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: FINISHED RxBleRadioOperationDescriptorWrite(131621266)
06-21 10:51:07.689 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: STARTED RxBleRadioOperationDescriptorWrite(250764313)
06-21 10:51:07.783 26640-26746/com.hatchbaby.rest.qa D/RxBle#BluetoothGatt: onDescriptorWrite descriptor=00002902-0000-1000-8000-00805f9b34fb status=0
06-21 10:51:07.786 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: FINISHED RxBleRadioOperationDescriptorWrite(250764313)
06-21 10:51:07.787 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: STARTED RxBleRadioOperationDisconnect(160892126)
06-21 10:51:07.787 26640-26640/com.hatchbaby.rest.qa D/BluetoothManager: getConnectionState()
06-21 10:51:07.787 26640-26640/com.hatchbaby.rest.qa D/BluetoothManager: getConnectedDevices
06-21 10:51:07.793 26640-26640/com.hatchbaby.rest.qa D/BluetoothGatt: cancelOpen() - device: E5:D6:FC:68:FB:55
06-21 10:51:07.797 26640-26653/com.hatchbaby.rest.qa D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=6 device=E5:D6:FC:68:FB:55
06-21 10:51:07.797 26640-26653/com.hatchbaby.rest.qa D/RxBle#BluetoothGatt: onConnectionStateChange newState=0 status=0
06-21 10:51:07.803 26640-26640/com.hatchbaby.rest.qa D/BluetoothGatt: close()
06-21 10:51:07.803 26640-26640/com.hatchbaby.rest.qa D/BluetoothGatt: unregisterApp() - mClientIf=6
06-21 10:51:07.807 26640-26690/com.hatchbaby.rest.qa D/RxBle#Radio: FINISHED RxBleRadioOperationDisconnect(160892126)

我很困惑;任何帮助表示赞赏!

最佳答案

确保调用了 close 方法。

close method

关于断开连接后,Android BLE 在后台连接,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44640917/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com