Stay organized with collections Save and categorize content based on your preferences.

TestAdSelectionManager

public class TestAdSelectionManager
extends Object

java.lang.Object
   ↳ android.adservices.adselection.TestAdSelectionManager


TestAdSelectionManager provides APIs for app and ad-SDKs to test ad selection processes as well as report impressions.

Summary

Public methods

void overrideAdSelectionConfigRemoteInfo(AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

Overrides the AdSelection API to avoid fetching data from remote servers and use the data provided in AddAdSelectionOverrideRequest instead.

void removeAdSelectionConfigRemoteInfoOverride(RemoveAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

Removes an override in the Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest.

void resetAllAdSelectionConfigRemoteOverrides(Executor executor, OutcomeReceiver<ObjectException> receiver)

Removes all override data in the Ad Selection API.

Inherited methods

Public methods

overrideAdSelectionConfigRemoteInfo

public void overrideAdSelectionConfigRemoteInfo (AddAdSelectionOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

Overrides the AdSelection API to avoid fetching data from remote servers and use the data provided in AddAdSelectionOverrideRequest instead. The AddAdSelectionOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

Parameters
request AddAdSelectionOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null.
receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

removeAdSelectionConfigRemoteInfoOverride

public void removeAdSelectionConfigRemoteInfoOverride (RemoveAdSelectionOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

Removes an override in th Ad Selection API with associated the data in RemoveAdSelectionOverrideRequest. The RemoveAdSelectionOverrideRequest is provided by the Ads SDK.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

Parameters
request RemoveAdSelectionOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null.
receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.

resetAllAdSelectionConfigRemoteOverrides

public void resetAllAdSelectionConfigRemoteOverrides (Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

Removes all override data in the Ad Selection API.

This method is intended to be used for end-to-end testing. This API is enabled only for apps in debug mode with developer options enabled.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

Parameters
executor Executor: This value cannot be null.
receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The receiver either returns a void for a successful run, or an Exception indicates the error.