Sdílet prostřednictvím


Settings.Secure.AndroidId Field

Definition

On Android 8.

[Android.Runtime.Register("ANDROID_ID")]
public const string AndroidId;
[<Android.Runtime.Register("ANDROID_ID")>]
val mutable AndroidId : string

Field Value

Attributes

Remarks

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.

<p class="note"><strong>Note:</strong> 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.</p>

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.

<p class="note"><strong>Note:</strong> 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.

Java documentation for android.provider.Settings.Secure.ANDROID_ID.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to