Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

AdvertisingIdProviderManager

open class AdvertisingIdProviderManager
kotlin.Any
   ↳ androidx.ads.identifier.provider.AdvertisingIdProviderManager

The AdvertisingIdProviderManager will be used by an Advertising ID Provider to register the provider implementation or retrieve all the Advertising ID Providers on the device. This package contains an implementation of the Advertising ID Provider Service that supports IAdvertisingIdService.aidl for communication with the developer library, allowing you to easily make your own Advertising ID Provider. Simply do the following:

  1. Implement the AdvertisingIdProvider interface in the provider library. Developer apps will be interacting with the provider through this programmatic interface.
  2. Register the implementation by calling registerProviderCallable within the provider’s android.app.Application#onCreate callback.
  3. Register the Advertising Id settings UI with the intent filter "androidx.ads.identifier.provider.OPEN_SETTINGS".

Summary

Public methods

open static MutableList<AdvertisingIdProviderInfo!>

Retrieves a list of all the Advertising ID Providers' information on this device, including self and other providers which is based on the AndroidX Advertising ID Provider library.

open static Unit

Registers the Callable to create an instance of AdvertisingIdProvider.

Public methods

getAdvertisingIdProviders

@NonNull open static fun getAdvertisingIdProviders(@NonNull context: Context): MutableList<AdvertisingIdProviderInfo!>

Retrieves a list of all the Advertising ID Providers' information on this device, including self and other providers which is based on the AndroidX Advertising ID Provider library.

This method helps one Advertising ID Provider find other providers. One usage of this is to link to other providers' settings activity from one provider's settings activity, so the user of the device can manager all the providers' settings together.

registerProviderCallable

open static fun registerProviderCallable(@NonNull providerCallable: Callable<AdvertisingIdProvider!>): Unit

Registers the Callable to create an instance of AdvertisingIdProvider.

This is used to lazy load the AdvertisingIdProvider when the Service is started.

This Callable will be called within the library's built-in Advertising ID Service's android.app.Service#onCreate method.

Provider could call this method to register the implementation in android.app.Application#onCreate, which is before android.app.Service#onCreate has been called.