Closed cow-yoon closed 2 months ago
if bluetooth is off, how is your phone still connected to the device? seems impossible. How do you know it is connected?
"However, I believe that if mBluetoothAdapter.isEnabled() == false, gatt.close() should be called."
please try it. modify the FBP code and try it. I think it is not necessary, but maybe Im wrong.
closing until there is more evidence the connection is still active after bluetooth is turned off.
Requirements
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.32.12
Flutter Version
3.24.2
What OS?
Android
OS Version
Android 14
Bluetooth Module
Nordic nRF52832
What is your problem?
Scenario:
On android 14,
When the autoConnect parameter is set to true in the connect() method, if Bluetooth is disabled (BluetoothAdapterState.off) and the disconnect() method is called, gatt.close() is not invoked.
In FlutterBluePlusPlugin.java, when newState is BluetoothProfile.STATE_DISCONNECTED, if the condition (mAutoConnected.containsKey(remoteId)) is true, only the log message "autoconnect is true. skipping gatt.close()" is currently logged. However, I believe that if mBluetoothAdapter.isEnabled() == false, gatt.close() should be called.
Ex)
I would appreciate it if you could let me know if there is another way to do gatt.close() in the above situation. Thank you for reading my problem.
Logs