The easiest way to get a unique ID of any Android device
Published in
1 min readFeb 5, 2019
On a device first boot, a unique random value is generated and stored. It’s a 64-bit number called ANDROID_ID. It should remain constant for a device lifetime. The value is available for smartphones and tablets.
Use the following code to retrieve the value:
String androidId = Settings.Secure.getString(getContentResolver(),
Settings.Secure.ANDROID_ID);
Caution: The id can be changed after performing a factory reset on the device.
😄 Happy Coding…
😄