1

I want my program to react on when some bluetooth device is on. So i want to know is there any Unique ID of each bluetooth device that can be use to identifiy Bluetooth device via BluetoothDevice android class. I cannot work with device name because there are lot of devices with the same name: Here is how i got the name:

  Set<BluetoothDevice> pairedDevices = mBluetoothAdapter.getBondedDevices();

            for (BluetoothDevice bt : pairedDevices) {
                String bluetoothDevice = bt.getName();
    }
Vuk Vasić
  • 1,398
  • 10
  • 27

1 Answers1

4

You can use device address:

bt.getAddress();
kamituel
  • 34,606
  • 6
  • 81
  • 98
  • Are you sure that this is unique address for each Bluetooth device? – Vuk Vasić Dec 18 '13 at 13:14
  • 2
    It's an industry agreement (same as MAC in ethernet world), so as long as device manufacturer does obey this rule, it should be unique. – kamituel Dec 18 '13 at 13:15
  • At many devices it is not consistent, permanent and should not be serialized for long term storage. Since many devices change their address every "once in a while" randomly. – Caspar Kleijne Dec 25 '16 at 19:42
  • This is not valid anymore since android 6.0. Please check [this](https://stackoverflow.com/questions/33377982/get-bluetooth-local-mac-address-in-marshmallow/33387430#33387430) link. – Michał Dobi Dobrzański Nov 10 '19 at 21:23