I can able to see two states in Bluetooth device in Android.
1. Paired
2. Connected. -
I am trying to get currently connected Bluetooth device in Android. But I am getting only paired device list from adapter.getBondedDevices();
I need currently connected device. How can i get this. Please someone help me to achieve this. Thanks in advance.
Swipe down from the top of the screen. Touch and hold Bluetooth . If your accessory is listed under "Available media devices," next to your device's name, tap Settings . If no accessories are listed under "Previously connected devices," tap See all.
Can someone connect to my Bluetooth without me knowing? Theoretically, anyone can connect to your Bluetooth and gain unauthorized access to your device if the visibility of your Bluetooth device is on.
That's pretty straight forward. Android BluetoothManager have method of
getConnectedDevices()
Implementation like:
BluetoothManager manager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
List<BluetoothDevice> connected = manager.getConnectedDevices(GATT);
Log.i("Connected Devices: ", connected.size()+"");
If you want more details about connected devices then you can use the above list method put it into for loop and get the inner details of each Bluetooth device which are connected.
Logs:
12-20 18:04:09.679 14933-14933/com.salman.dleague.blescanning I/Connected Devices:: 2
Hope its helpful :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With