Domanda

I am trying to get the list of the bonded bluetooth devices on the phone. My problem is that I am getting it in a "non friendly" way. Here is my code:

BluetoothAdapter mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();
    ArrayList<String> listview = 
        new ArrayList<String>(Arrays.asList(pairedDevices.toString()));

I'm getting: 00:23:7f:5f:fe:1c...

How can i get the friendly names and not numbers?

Just to add that I know about getname(), but as I understand its only for a connected device and not for the bonded devices.

È stato utile?

Soluzione

the getName() method of the BluetoothDevice device class will help you out. Just iterate through the Set and call the getName() method on each BluetoothDevice object.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top