Checking if Bluetooth is connected to a given BT address

Hi all - can I pls know how to check if BT is currently connected to a given BT address? Note that:

  1. I'm checking the connectivity to a BT speaker where address is known.
  2. No need to poll, testing this once at screen initialization will suffice.
  3. BluetoothClient.IsConnected is not helpful, as it's not checking if it's connected to a given BT address, besides it's also returning TRUE even if BT is disconnected.

You need to send something to the BT module. If the module is disabled, you will get error 516. Then you can react accordingly.

Thanks a lot for the swift reply. In my case I'm checking the connectivity to a BT speaker, so not too sure how to send some data to it as it's designed for audio - but I will check. Thanks again!

Hmm, and for what purpose do you connect the BT speaker with the app?

Can you connect to your speaker from the app using BletoothClient?

App is just a simple mp3 player, and it needs to indicate if the mobile phone is currently connected to this particular BT speaker when the app is launched. I could get it to show if this BT speaker is paired with the mobile phone using IsDevicePaired by giving its BT address, but not able to correctly show if it's currently connected to it or not.

Hmm - only BLE supports audio but App Inventor's BLE Extension does not support that feature (yet).

Apparently Bluetooth Classic actually supports point-to-point communication for audio transmission. Again, it's not supported by AI2.

Nope, I was not able to connect to the BT speaker with BTClient either...I guess that's why IsConnected is also not functioning properly. So my app is just paying back MP3s & relying on the BT connection already made by mobile phone to it.

Ok, then looks like I have to wait until AI2 supports this in future!

It might be possible for one of the extension developers to add this capability.

Yep, that would be awesome!