public class AdvertisingIdClient
extends Object


Client for retrieving Advertising ID related info from an AndroidX ID Provider installed on the device.

Typical usage would be:

  1. Call isAdvertisingIdProviderAvailable(Context) to make sure there is an Advertising ID Provider available.
  2. Call getAdvertisingIdInfo(Context) to get Advertising ID info (the Advertising ID and LAT setting).


Public methods

static ListenableFuture<AdvertisingIdInfo> getAdvertisingIdInfo(Context context)

Retrieves the user's Advertising ID info.

static boolean isAdvertisingIdProviderAvailable(Context context)

Checks whether there is any Advertising ID Provider installed on the device.

Inherited methods

Public methods


public static ListenableFuture<AdvertisingIdInfo> getAdvertisingIdInfo (Context context)

Retrieves the user's Advertising ID info.

When multiple Advertising ID Providers are installed on the device, this method will always return the Advertising ID information from same Advertising ID Provider for all apps which use this library, using following priority:

  1. System-level providers with "" permission
  2. Other system-level providers

If there are ties in any of the above categories, it will use this priority:

  1. First app by earliest install time (PackageInfo.firstInstallTime)
  2. First app by package name alphabetically sorted

context Context: Current Context (such as the current Activity).

ListenableFuture<AdvertisingIdInfo> A