I was trying to create a personal app that easily toggles any bluetooth device that I am paired to. I was able to get BluetoothDevice
set from BluetoothAdapter
. I can't find a way to connect to the device. None of the existing solutions worked. Most of them are for creating a socket and communicating with it. I just want to connect to the device. Is it even possible? It's a bit frustrating to go to Settings -> Bluetooth -> Previous Devices -> Click on the device -> Connect or disconnect. Is there no method that gives us this functionality?
Edit: https://i.stack.imgur.com/iM9uF.jpg This is the feature I'm trying to implement. Instead of going all the way to the settings and clicking connect, I was trying to make a janky app to do it with one click.