I am battling to figure out a bug and would appreciate some help.
At first I thought that my app was holding on to connections and I searched for memory leaks but then I was able to reproduce the problem using the MIDI+BTLE app.
What happens is roughly this:
1. Scan for BLE MIDI device (In my case I’ve tested with a CME WIDI Jack and a Yamaha MD-BT01)
2. Connect to the device
3. Kill the app (the device eventually disconnects)
4. Scan and connect again (the device connects) (At this point in my app I can open an input port and send MIDI commands but nothing is transmitted. From this point on even though the device never connects again, Android seems to report it as a linked device, allows me to open an input port and communicate with the device but it remains physically disconnected the entire time)
5. Kill the app (the device does not disconnect)
6. Can’t see the device in scan because it’s still connected
7. Turn off Bluetooth on the phone
8. The device disconnects
9. Scan for the device and connect (It says it’s connected but the device remains disconnected)
10. Unpair the device
11. Scan for device and connect (It says it’s connected but the device remains disconnected. You can actually see the device in the scan even though it’s seen as connected in the MIDI-BTLE app)
The phone is a Galaxy A33 running Android 13 (API level 33)
Is this an Android bug? Has anyone seen this behaviour?