I want to listen for connection/disconnection with a number of specific bluetooth devices whose MAC addresses I know, but which are not necessarily paired (I don't want to mess with the user's list of paired devices and vice versa). I'm only interested in discovering their presence, not communicating with them.

This works very well with my code below! But my problem is that I cannot find out which specific device is connecting/disconnecting, only that it happens to someone of them. How can I find out which one the action concerns?

First I instantiate objects for my two specific physical bluetooth devices and add them to my intent filter:

    BluetoothDevice myPinkHeadset = mBluetoothAdapter.getRemoteDevice("18:17:0C:EB:9C:81");
    BluetoothDevice myPcBluetoothDongle = mBluetoothAdapter.getRemoteDevice("5A:7A:CC:4B:C5:08");

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(myPinkHeadset.ACTION_ACL_CONNECTED);
    intentFilter.addAction(myPinkHeadset.ACTION_ACL_DISCONNECTED);
    intentFilter.addAction(myPcBluetoothDongle.ACTION_ACL_CONNECTED);
    intentFilter.addAction(myPcBluetoothDongle.ACTION_ACL_DISCONNECTED);

Then I listen for broadcasts about them:

    final BroadcastReceiver intentReceiver = new BroadcastReceiver() {  
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();

Now I want to find out which one has been connected and/or disconnected, and I don't see how I can do that.

Either 1) I use "BluetoothDevice" directly. It reacts to the broadcast alright, but it doesn't tell me which of the two physical devices the action concerns. Is their a way to find out? Bluetooth.getName() is not allowed because it's not a static class.

if (BluetoothDevice.ACTION_ACL_CONNECTED.equals(action)) { 
        } 

or 2) I listen for both actions for both devices.

Edit
Report