Open iBog opened 8 months ago
small addition, BLE device is not switched off, it always on me and working, flutter app should periodically connect to device and disconnect from it.
Does the connection closed after you called disconnect
method manully?
In my opinion, it's the system's duty to disconnect the BLE device when app closed, and our BLE device did disconnected when I close my app.
I found there some cases on the internet that the connection still connected after app closed, but I can't find anything useful... https://stackoverflow.com/questions/73107781/devices-with-android-12-keep-bluetooth-le-connection-even-when-app-is-closed https://github.com/evothings/cordova-ble/issues/136
@yanshouwang according to connectionStateChanged, connectionState become false. Agree with you, looks like system delay on releasing connection with device. Also found solution in quick.blue library: https://github.com/pauldemarco/flutter_blue/issues/317#issuecomment-522134619
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
This issue is stale because it has been open for 30 days with no activity.
Trying to connect to BLE "HR monitor" device. App should auto search all devices, found by name, connect, subscribe characteristic to notify every data change. await CentralManager.instance.setCharacteristicNotifyState( characteristic, state: true, ); All this steps working fine, data start flowing.
On app close (hide) - App should auto disconnect from device. On this step I call two actions - 1) await CentralManager.instance.setCharacteristicNotifyState( characteristic, state: false, ); To stop characteristic subscription 2) await CentralManager.instance.disconnect(peripheral); to disconnect from BLE device itself
After application Resume, need to start from the beginning: Search, Connect... but BLE device not listed in search list anymore. As I understand, connection with BLE not stopped, and device still attached. If temporary switch OFF bluetooth on Android, and run Search BLE devices again - "HR monitor" appeared again, because "pairing" was interrupted and device is ready to be searched and connected
Guide me what i did wrong, or package "bluetooth_low_energy" has an issue when App using CharacteristicNotify