does anybody else have a problem with Bluetooth Classic IsConnected function since ... today or yesterday (app. sept. 23. 2021) I think?
I can get it to report connected state but not disconnected.
An older .apk still works, todays AI Companion build does not.
That is on Android 8.
as the bluetooth protocol was designed, there is no way to detect, if a connection still is alive, therefore you have to send regularly (i.e. poll) some data to the device. And if you get an error, then you know, that the connection was lost…
My previous app version had me thinking IsConnected was working, while in fact it was error handling (Error 516) plus periodic sending of time sync data. So exactly:
"...therefore you have to send regularly (i.e. poll) some data to the device. And if you get an error, then you know, that the connection was lost…"
Yes, this an annoying implementation at the Android level. I've looked into the Android OSP code and the connected flag at the library level is just implemented as a boolean and isn't really reflective of the underlying hardware state. I wish we could provide a better experience but there's not much to work with.
Thank you for your reply.
A "client polling" solution together with error checking should solve this problem as suggested by Taifun. I "accidentaly" had that in my previous sketch and than broke it.