Programmatically Obtain the Bluetooth MAC Address in Android Oreo Version

Hi community,

We connect the external scanners to the devices in SPP mode. We are doing tests with a terminal TC51 with Android Oreo (8.1) and I am not able to find how to obtain the MAC address of the Bluetooth, programmatically. With versions of Android before Oreo, we know how to do it, but this functionality has changed with Oreo, someone knows how to get it?

Thank you

Dmitry Prokhorov
Hello Eduardo,As you can see

Hello Eduardo,

As you can see here Android 6.0 Changes  |  Android Developers

Programmatic access to to MAC addresses has been removed starting from Android 6.0:

"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"

Dmitry Prokhorov

Software Engineer, Kutir Mobility

Posted on behalf of Zebra Technologies

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Eduardo Rubio Rey
As you probably know, there

As you probably know, there were tricks to get this value, despite the fact that this security limitation was established in version 6. This alternative way worked until Oreo 8.0. However, Oreo 8.1 has been blocked.

I understand that data protection is important, but the great majority of Zebra devices are oriented to the industrial environment, not for consumer. For software developers, who work to offer simple applications to users, this type of data is fundamental.

Thanks for you annswer.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Anonymous (not verified)
Hi Eduardo.  Why do you need

Hi Eduardo.  Why do you need to know the MAC address of the Android device when you are connecting to an SPP Bluetooth scanner, wouldn't you just need the MAC address of the scanner so you can connect to it (where the scanner is acting as the BT slave).  Sorry if I'm not understanding something here.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Eduardo Rubio Rey
Hi Darryn,Sorry for my delay

Hi Darryn,

Sorry for my delay in response.

I will try to explain the problem and why we need to access the Bluetooth MAC ADDRESS.

We develop applications for one of the largest integrators in France. We have numerous customers that work with Windows CE / Mobile terminals that use, at the same time, the internal scanner and an external scanner (wired or BT) depending on the operations that the user has to perform.

Now we are developing the same solutions in Android environment (migration). And customers want to keep their way of working, with two scanners simultaneously.

We consulted with Zebra support to be able to implement this way of working and they informed us that: we can only have one scanner connected at a time using the EMDK and SSI. OK, then the solution is that the Internal Scanner will be using SSI and the BT scanner (RS507, for example) via SPP.

Knowing that we need to connect the external scanner in SPP mode, we need the MAC ADDRESS to be able to create the barcode, which allows users to easily pair the BT scanner. The same case as performing the Bluetooth Pairing Utility for SSI mode.

I hope my explanation complements my initial question. Thank you.

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Anonymous (not verified)
Thanks Eduardo,That is

Thanks Eduardo,

That is interesting... I had not realised that SPP supported the RS507 acting as both the master or the slave but that is indeed the case, thank you for teaching me something

If you can't connect the RS507 as the client, therefore negating the need to generate the Android device's MAC address barcode, and need the RS507 to connect as the master then I'm afraid access to the device MAC address would be a feature request and if you have already been speaking with support then that would be the best channel to raise this request.  If you are interested, I do have an app I created a while back that connects to the RS507 when it is connected in SPP client mode: GitHub - darryncampbell/GenericScanWedge: Implements an Android service that provides a rudimentary implementation of Ze…

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Eduardo Rubio Rey
Thank you very much Darryn

Thank you very much Darryn for your response. We will request through Zebra Support if it is viable to perform this feature request.

Thank you for your contribution about the SPP client mode, unfortunately we need to do it through master mode.

Vote: 
Vote up!
Vote down!

Points: 1

You voted ‘up’


Maor Hadad
Did you manage to get the device Bluetooth mac address?

Did you manage to get the device Bluetooth mac address?

Vote: 
Vote up!
Vote down!

Points: 0

You voted ‘up’


Log in to post comments