BluetoothLE1 Disconnect issue Background Tasks: Itoo

Hello Sir,
The MAC address is stored into itoo.
Next, I press Start button(GREEN).
In Android 12, when start button is pressed, it connects (Connected) after 3 seconds app sends data RELAY_ON (SendOnClock is 3000), i.e procSendOnClock clock runs after 3 seconds. (ProcessStopClock = 3000 true) once the data is sent, after 3 seconds procProcessStopClock clock executes and disconnects from ESP32.

In android 14, when start button is pressed, it connects ESP32 (Connected) after 3 seconds app sends data RELAY_ON, i.e procSendOnClock clock runs. once the data is sent, after 3 seconds procProcessStopClock clock executes (Till here everything works fine) but BluetoothLE1.disconnect does not disconnect from the connected ESP32 module.

Your codebase is pretty messy. Please state what you are trying to achieve. I can help you.

When the user presses the start button, a background process should initialize.

Once the background process starts, the device should establish a connection with the ESP32 module via BLE

Once the connection is established, either the RELAY_ON or RELAY_OFF command (depending on your logic) should be sent to the ESP32 module.

After successfully sending the command, the device should disconnect from the ESP32 module.