From dbe1616395df4b54d2a7d37fba658f916c395b28 Mon Sep 17 00:00:00 2001 From: Shashank Agrawal Date: Thu, 23 Sep 2021 23:25:38 +0530 Subject: [PATCH] docs: Update information about device.uuid for Android (#138) The behaviour of `device.uuid` has been changed since Android 8.0 https://developer.android.com/about/versions/oreo/android-8.0-changes#privacy-all --- README.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 91612e0c..ec31fee9 100644 --- a/README.md +++ b/README.md @@ -148,7 +148,6 @@ The details of how a UUID is generated are determined by the device manufacturer ```js // Android: Returns a random 64-bit integer (as a string, again!) -// The integer is generated on the device's first boot // // BlackBerry: Returns the PIN number of the device // This is a nine-digit unique integer (as a string, though!) @@ -162,6 +161,22 @@ The details of how a UUID is generated are determined by the device manufacturer var deviceID = device.uuid; ``` +### Android Quirk + +The `uuid` on Android is a 64-bit integer (expressed as a hexadecimal string). The behaviour of this `uuid` is different on two different OS versions- + +**For < Android 8.0 (API level 26)** + +In versions of the platform lower than Android 8.0, the `uuid` is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device. + +**For Android 8.0 or higher** + +The above behaviour was changed in Android 8.0. Read it in detail [here](https://developer.android.com/about/versions/oreo/android-8.0-changes#privacy-all). + +On Android 8.0 and higher versions, the `uuid` will be unique to each combination of app-signing key, user, and device. The value is 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. + +Read more here https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID. + ### iOS Quirk The `uuid` on iOS uses the identifierForVendor property. It is unique to the device across the same vendor, but will be different for different vendors and will change if all apps from the vendor are deleted and then reinstalled.