问题
I'm attempting to transmit as a beacon an Android phone using the altbeacon library. I am trying to get Bluetooth mac address in transmitter side.
Is it possible or Can I get MacAddress?
[https://i.stack.imgur.com/cBpXz.png]
[https://i.stack.imgur.com/bj3nM.png]
回答1:
Android, like iOS emits a randomized MAC in its advertisements since Android 5.0+. This randomized MAC will not be the same as the physical MAC of your Bluetooth device reported in Settings.
There is no way to turn this off or to determine the physical MAC on the receiver side.
Further, Android 6.0+ blocks accessing the physical MAC via programming on the device itself:
To provide users with greater data protection, starting in this release, Android removes programmatic access to the device’s local hardware identifier for apps using the Wi-Fi and Bluetooth APIs. The WifiInfo.getMacAddress() and the BluetoothAdapter.getAddress() methods now return a constant value of 02:00:00:00:00:00.
This means you cannot use a program to read the MAC then embed it inside the advertisement data payload.
The only way to do this might be to have the end user type in the physical MAC (determined from the settings screen) and then put the typed in bytes into the data fields of the advertisement.
来源:https://stackoverflow.com/questions/60520882/altbeacon-get-macaddress-in-transmitter