Is it possible to temporarily disable the device in order not to go through the pairing procedure in the future? For example, a fitness bracelet and a headset in a car are connected to a smartphone. I want to be able to leave the connection with the bracelet, but sometimes turn off the headset in the car.
1 answer
Android does not have the ability to get a list of "currently connected" devices. A list of all "paired" devices (regardless of whether it is connected now or not) can be obtained as follows:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices(); You can use a broadcast receiver to receive ACTION_ACL_CONNECTED with device connection information.
Starting from 4.3 (API 18), the getConnectionState () method has been introduced.
|