1

I am developing an application where I need to identify each device's unique Id. Is there any way to get the device's unique Id programmatically in Java?

I tried some solutions but the device Id got changed on the device reset.

  • worth looking at https://www.geeksforgeeks.org/how-to-fetch-device-id-in-android-programmatically/ – Dark Knight Mar 03 '23 at 09:27
  • You can try the below code (but there are chances that device id might get update on device reset): `@SuppressLint("HardwareIds") public static final String ANDROID_DEVICE_ID = Settings.Secure.getString(getContext().getContentResolver(), Settings.Secure.ANDROID_ID);` – Dhruv Mar 03 '23 at 09:33
  • 1
    The short answer is: no, there is **intentionally** no way to definitely re-identify the same device after a device reset. There are IDs provided for various use-cases, but they all come with one restriction or another. Pick the best fit, but cease your search for the "holy grail" (or doomsday device for user privacy, as I'd like to call it). – Joachim Sauer Mar 03 '23 at 09:47
  • if you have some sort of login mechanism that is backed by a database... that could be a direction to work in – experiment unit 1998X Mar 03 '23 at 10:01

0 Answers0