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

AdSelectionManager

public class AdSelectionManager
extends Object

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


AdSelection Manager provides APIs for app and ad-SDKs to run ad selection processes as well as report impressions.

Summary

Public methods

TestAdSelectionManager getTestAdSelectionManager()
void reportImpression(ReportImpressionRequest request, Executor executor, OutcomeReceiver<ObjectException> receiver)

Report the given impression.

void selectAds(AdSelectionConfig adSelectionConfig, Executor executor, OutcomeReceiver<AdSelectionOutcomeException> receiver)

Runs the ad selection process on device to select a remarketing ad for the caller application.

Inherited methods

Public methods

getTestAdSelectionManager

public TestAdSelectionManager getTestAdSelectionManager ()

Returns
TestAdSelectionManager This value cannot be null.

reportImpression

public void reportImpression (ReportImpressionRequest request, 
                Executor executor, 
                OutcomeReceiver<ObjectException> receiver)

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

Parameters
request ReportImpressionRequest: This value cannot be null.

executor Executor: This value cannot be null.

receiver OutcomeReceiver: This value cannot be null.

Returns
void This value cannot be null.

selectAds

public void selectAds (AdSelectionConfig adSelectionConfig, 
                Executor executor, 
                OutcomeReceiver<AdSelectionOutcomeException> receiver)

Runs the ad selection process on device to select a remarketing ad for the caller application.

The input adSelectionConfig is provided by the Ads SDK and the AdSelectionConfig object is transferred via a Binder call. For this reason, the total size of these objects is bound to the Android IPC limitations. Failures to transfer the AdSelectionConfig will throws an TransactionTooLargeException.

The output is passed by the receiver, which either returns an AdSelectionOutcome for a successful run, or an Exception includes the type of the exception thrown and the corresponding error message.

If the IllegalArgumentException is thrown, it is caused by invalid input argument the API received to run the ad selection.

If the IllegalStateException is thrown with error message "Failure of AdSelection services.", it is caused by an internal failure of the ad selection service.

If the TimeoutException is thrown, it is caused when a timeout is encountered during bidding, scoring, or overall selection process to find winning Ad.

Parameters
adSelectionConfig AdSelectionConfig: This value cannot be null.

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