AdvertisingIdClient | Google Play services | Google for Developers (original) (raw)
AdvertisingIdClient
Helper library for retrieval of advertising ID and related information such as the limit ad tracking setting.
It is intended that the advertising ID completely replace existing usage of other identifiers for ads purposes (such as use of ANDROID_ID in [Settings.Secure](//developer.android.com/reference/android/provider/Settings.Secure.html)) when Google Play Services is available. Cases where Google Play Services is unavailable are indicated by a [ GooglePlayServicesNotAvailableException](/android/reference/com/google/android/gms/common/GooglePlayServicesNotAvailableException) being thrown by getAdvertisingIdInfo().
Nested Class Summary
Public Method Summary
Inherited Method Summary
From class java.lang.Object
| Object | clone() |
|---|---|
| boolean | equals(Object arg0) |
| void | finalize() |
| final Class<?> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| String | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |
Public Methods
public static AdvertisingIdClient.Info getAdvertisingIdInfo (Context context)
Retrieves the user's advertising ID and limit ad tracking preference.
This method cannot be called in the main thread as it may block leading to ANRs. AnIllegalStateException will be thrown if this is called on the main thread.
Returns
- AdvertisingIdClient.Info with user's advertising ID and limit ad tracking preference.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.