可以通过使用Android的BluetoothAdapter类的方法来获取蓝牙设备的MAC地址。下面是一个简单的示例代码:
```
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
if (bluetoothAdapter != null) {
Set
for (BluetoothDevice device : bondedDevices) {
String macAddress = device.getAddress();
// do something with the mac address
}
}
```
在这里,我们首先使用getDefaultAdapter()方法获取蓝牙适配器实例。然后,我们使用getBondedDevices()方法获取已配对的设备列表,并遍历列表中的设备。对于每个设备,我们使用getAddress()方法获取其MAC地址。
请注意,对于未配对的设备,无法直接获取其MAC地址。您可能需要首先与设备进行配对,然后才能获取其MAC地址。