TestCustomAudienceManager


public class TestCustomAudienceManager
extends Object

java.lang.Object
   ↳ android.adservices.customaudience.TestCustomAudienceManager


TestCustomAudienceManager provides APIs for app and ad-SDKs to test custom audiences.

Summary

Public methods

void overrideCustomAudienceRemoteInfo(AddCustomAudienceOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

Overrides the Custom Audience API to avoid fetching data from remote servers and use the data provided in AddCustomAudienceOverrideRequest instead.

void removeCustomAudienceRemoteInfoOverride(RemoveCustomAudienceOverrideRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

Removes an override in th Custom Audience API with associated the data in RemoveCustomAudienceOverrideRequest.

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

Removes all override data in the Custom Audience API.

Inherited methods

Public methods

overrideCustomAudienceRemoteInfo

public void overrideCustomAudienceRemoteInfo (AddCustomAudienceOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

Overrides the Custom Audience API to avoid fetching data from remote servers and use the data provided in AddCustomAudienceOverrideRequest instead. The AddCustomAudienceOverrideRequest 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.

This call will fail silently if the owner in the request is not the calling app's package name.
Requires AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE

Parameters
request AddCustomAudienceOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

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.

removeCustomAudienceRemoteInfoOverride

public void removeCustomAudienceRemoteInfoOverride (RemoveCustomAudienceOverrideRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

Removes an override in th Custom Audience API with associated the data in RemoveCustomAudienceOverrideRequest.

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 RemoveCustomAudienceOverrideRequest: This value cannot be null.

executor Executor: This value cannot be null. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

receiver OutcomeReceiver: This value cannot be null.

Throws
IllegalStateException if this API is not enabled for the caller

The RemoveCustomAudienceOverrideRequest is provided by the Ads SDK. The receiver either returns a void for a successful run, or an Exception indicates the error.

resetAllCustomAudienceOverrides

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

Removes all override data in the Custom Audience 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. Callback and listener events are dispatched through this Executor, providing an easy way to control which thread is used. To dispatch events through the main thread of your application, you can use Context.getMainExecutor(). Otherwise, provide an Executor that dispatches to an appropriate thread.

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.