Android device identification: differences between Android ID and UUID

203 views Asked by At

We are replacing the identification of Android terminals by abandoning the IMEI and evaluating alternatives.

It is acceptable to us that the identifier changes after each reinstallation of the app. What we would need is a guarantee that two devices can never have the same identifier.

We found several possible approaches such as: ANDROID ID

String androidID = Android.Provider.Settings.Secure.GetString(cnt.ContentResolver, Android.Provider.Settings.Secure.AndroidId);

UUID

String uniqueID = UUID.randomUUID().toString();

What is the difference between these identifiers? In particular:

  • With which of the two identifiers does one eliminate (or reduce) the risk/probability of obtaining the same identifier on multiple devices?
  • What is the most persistent way to store the data in order to reduce the possibility that it needs to be regenerated?

Many thanks in advance

1

There are 1 answers

5
ΓDΛ On BEST ANSWER

Your question contains more than one question.

What is the best way to uniquely identify and distinguish numerous devices with Android 10 or later using Xamarin Android?

Unfortunately, there is no sure way to do this.

The most practical way I can think of. You can define the recording date as day month year hour minute second millisecond.

This question was discussed many years ago and remains relevant.

UUID

128-bit value used to uniquely identify an object or entity on the internet

AndroidID

On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device.

public static final String ANDROID_ID

Android ID's


On Android 8.0 (API level 26) and higher versions of the platform, a 64-bit number (expressed as a hexadecimal string), unique to each combination of app-signing key, user, and device. Values of ANDROID_ID are scoped by signing key and user. The value may change if a factory reset is performed on the device or if an APK signing key changes. For more information about how the platform handles ANDROID_ID in Android 8.0 (API level 26) and higher, see Android 8.0 Behavior Changes.

Note: For apps that were installed prior to updating the device to a version of Android 8.0 (API level 26) or higher, the value of ANDROID_ID changes if the app is uninstalled and then reinstalled after the OTA. To preserve values across uninstalls after an OTA to Android 8.0 or higher, developers can use Key/Value Backup.

In versions of the platform lower than Android 8.0 (API level 26), a 64-bit number (expressed as a hexadecimal string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. On devices that have multiple users, each user appears as a completely separate device, so the ANDROID_ID value is unique to each user.

Note: If the caller is an Instant App the ID is scoped to the Instant App, it is generated when the Instant App is first installed and reset if the user clears the Instant App.


With which of the two identifiers does one eliminate (or reduce) the risk/probability of obtaining the same identifier on multiple devices?

UUID

What is the most persistent way to store the data in order to reduce the possibility that it needs to be regenerated?

I recommend cloud and server services.