I used the following code to get a list of all the paired devices in the mobile phone:
BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
List<String> s = new ArrayList<String>();
for (BluetoothDevice bt : pairedDevices) {
s.add(bt.getName());
}
for (int index = 0; index < s.size(); index++) {
Toast.makeText(this, "Device Name: " + s.get(index), Toast.LENGTH_SHORT).show();
}
I have Bluetooth headsets that are already paired and I want my application to connect to those headphones in this way: