Serial Number and BT MAC in Android 10+

Hello,
I’d like to know if there is an API to get the serial number and the Bluetooth MAC of an Android 10+ device programmatically.

Thank you in advance.

Hello @Mireia_Moya ,

To read the Serial Number on Datalogic Android 10 devices you can use the “SERIAL_NUMBER” static field made available within the com.datalogic.device.info.SYSTEM class starting from the release 1.27 of Datalogic SDK (see com.datalogic.device.info.SYSTEM reference documentation).

//Android 10, SDK 1.27, any app
return com.datalogic.device.info.SYSTEM.SERIAL_NUMBER

See also the detailed post we published just in these days: How to read the Serial Number on Datalogic Android Devices

.

About the Bluetooth MAC address, the method to read is BluetoothAdapter.getAddress(), but unfortunately the situation is similar to the SerialNumber. As stated in the article Android 6.0 Changes - Access to Hardware Identifier, to "provide users with greater data protection […] Android removed 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".
The only exception, then, is for System Apps that can gain the android.permission.LOCAL_MAC_ADDRESS restricted permission, but unavailable for third party apps.

See also: Source.android - Immutable Device IDs

Today, October 2021, Datalogic SDKs do not include any direct method to access the Bluetooth MAC address nor Wifi MAC address. We took note of this need and we will consider it for future improvements.

Meanwhile, if you need to overcome this Android Limitation, please get in contact with our Tech Support team by filling the module https://www.datalogic.com/eng/contact-us/technical-support-cts-8.html.

Simone Callegari
Mobile Products L3 Specialist SW Engineer

Hi Simone,

I have a device with Android 10 and Datalogic SDK 1.27 however when I call the SYSTEM.SERIAL_NUMBER I receive the following error

java.lang.NoSuchFieldError: No static field SERIAL_NUMBER of type Ljava/lang/String; in class Lcom/datalogic/device/info/SYSTEM; or its superclasses (declaration of ‘com.datalogic.device.info.SYSTEM’ appears in /system/framework/framework.jar!classes3.dex)

Any ideas?

Hello @Dion_Gatsios,

One of the possible meanings of the java.lang.NoSuchFieldError message is that an application was created with a link to a library that includes some new symbols, but the application is running on a device with an earlier version of that library, in which those symbols were not yet defined.

Looking at the com.datalogic.device.info.SYSTEM.SERIAL_NUMBER documentation , you can see that the SERIAL_NUMBER field has been introduced with the revision 28 , while your device’s FW includes the SDK revision 1.27

To upgrade the SDK revision of your device, you have to update the device’s FW to a release which includes at least the Datalogic SDK 1.28.

The firmware update for Andriod Datalogic devices with GMS support requires a valid Shield Service Contract .

For more information on the Datalogic Shield program, please visit: www.datalogic.com/Shield .

Here are step-by-step instructions on how to update a Memor 10 with Shield firmware: download PDF here .

Note that the Shield program has a grace period allowing “free” downloads for 90 days from the device ship date (could be ship date to distributor or reseller).
This date is the same as warranty start date as can be found using the warranty lookup tool we have on our extranet: https://partnernet.datalogic.com/warranty-status-look-up/26/16/fm

Simone Callegari
Mobile Computer Specialist Support L3 Engineer | Datalogic