Unique device IDs


Is there a reliable way to get a unique ID for each device in Android?

We have tried to use Build.getSerial() with the proper system permissions and for some VIM4 devices we are getting the device serial number but for some we are getting 0000000000 so we cannot use this.

We are now currently using the Secure.ANDROID_ID property which gives seemingly unique IDs but we would need to understand how this property is set by Khadas and when it will change?

Or is there some other way of getting a truly unique ID that will not change for the device during its lifetime?

Best regards,

@kevinff You can determine uniqueness through mac addr.

VIM4:/ $ cat sys/class/net/eth0/address
VIM4:/ $

MAC address would not be a good option since it’s possible for the user to change this on the device. What other options are there?

@kevinff Our device’s mac addr cannot be changed by the user. The mac addr is burned into the cpu during mass production, and cannot be changed. Then the system reads the mac addr from the cpu.