Share via


AdSelectionManager.SelectAds Method

Definition

Overloads

SelectAds(AdSelectionConfig, IExecutor, IOutcomeReceiver)

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

SelectAds(AdSelectionFromOutcomesConfig, IExecutor, IOutcomeReceiver)

Selects an ad from the results of previously ran ad selections.

SelectAds(AdSelectionConfig, IExecutor, IOutcomeReceiver)

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

[Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)]
[Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")]
public virtual void SelectAds (Android.AdServices.AdSelection.AdSelectionConfig adSelectionConfig, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)]
public virtual void SelectAds (Android.AdServices.AdSelection.AdSelectionConfig adSelectionConfig, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[<Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)>]
[<Android.Runtime.RequiresPermission("android.permission.ACCESS_ADSERVICES_CUSTOM_AUDIENCE")>]
abstract member SelectAds : Android.AdServices.AdSelection.AdSelectionConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.SelectAds : Android.AdServices.AdSelection.AdSelectionConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
[<Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=34)>]
abstract member SelectAds : Android.AdServices.AdSelection.AdSelectionConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.SelectAds : Android.AdServices.AdSelection.AdSelectionConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit

Parameters

adSelectionConfig
AdSelectionConfig
executor
IExecutor
receiver
IOutcomeReceiver
Attributes

Remarks

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 input adSelectionConfig contains Decision Logic Uri that could follow either the HTTPS or Ad Selection Prebuilt schemas.

If the URI follows HTTPS schema then the host should match the seller. Otherwise, IllegalArgumentException will be thrown.

Prebuilt URIs are a way of substituting a generic pre-built logics for the required JavaScripts for scoreAds. Prebuilt Uri for this endpoint should follow;

<ul> <li>ad-selection-prebuilt://ad-selection/<name>?<script-generation-parameters></ul>

If an unsupported prebuilt URI is passed or prebuilt URI feature is disabled by the service then IllegalArgumentException will be thrown.

See AdSelectionConfig.Builder#setDecisionLogicUri for supported <name> and required <script-generation-parameters>.

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.

If the LimitExceededException is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the SecurityException is thrown, it is caused when the caller is not authorized or permission is not requested.

Java documentation for android.adservices.adselection.AdSelectionManager.selectAds(android.adservices.adselection.AdSelectionConfig, java.util.concurrent.Executor, android.os.OutcomeReceiver<android.adservices.adselection.AdSelectionOutcome, java.lang.Exception>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

SelectAds(AdSelectionFromOutcomesConfig, IExecutor, IOutcomeReceiver)

Selects an ad from the results of previously ran ad selections.

[Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionFromOutcomesConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionFromOutcomesConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=35)]
public virtual void SelectAds (Android.AdServices.AdSelection.AdSelectionFromOutcomesConfig adSelectionFromOutcomesConfig, Java.Util.Concurrent.IExecutor executor, Android.OS.IOutcomeReceiver receiver);
[<Android.Runtime.Register("selectAds", "(Landroid/adservices/adselection/AdSelectionFromOutcomesConfig;Ljava/util/concurrent/Executor;Landroid/os/OutcomeReceiver;)V", "GetSelectAds_Landroid_adservices_adselection_AdSelectionFromOutcomesConfig_Ljava_util_concurrent_Executor_Landroid_os_OutcomeReceiver_Handler", ApiSince=35)>]
abstract member SelectAds : Android.AdServices.AdSelection.AdSelectionFromOutcomesConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit
override this.SelectAds : Android.AdServices.AdSelection.AdSelectionFromOutcomesConfig * Java.Util.Concurrent.IExecutor * Android.OS.IOutcomeReceiver -> unit

Parameters

adSelectionFromOutcomesConfig
AdSelectionFromOutcomesConfig
executor
IExecutor
receiver
IOutcomeReceiver
Attributes

Remarks

Selects an ad from the results of previously ran ad selections.

The input adSelectionFromOutcomesConfig is provided by the Ads SDK and the AdSelectionFromOutcomesConfig 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 AdSelectionFromOutcomesConfig 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.

The input adSelectionFromOutcomesConfig contains:

<ul> <li>Seller is required to be a registered android.adservices.common.AdTechIdentifier. Otherwise, IllegalStateException will be thrown. <li>List of ad selection ids should exist and come from AdSelectionManager#selectAds calls originated from the same application. Otherwise, IllegalArgumentException for input validation will raise listing violating ad selection ids. <li>Selection logic URI that could follow either the HTTPS or Ad Selection Prebuilt schemas.

If the URI follows HTTPS schema then the host should match the seller. Otherwise, IllegalArgumentException will be thrown.

Prebuilt URIs are a way of substituting a generic pre-built logics for the required JavaScripts for selectOutcome. Prebuilt Uri for this endpoint should follow; <ul> <li>ad-selection-prebuilt://ad-selection-from-outcomes/<name>?<script-generation-parameters></ul>

If an unsupported prebuilt URI is passed or prebuilt URI feature is disabled by the service then IllegalArgumentException will be thrown.

See AdSelectionFromOutcomesConfig.Builder#setSelectionLogicUri for supported <name> and required <script-generation-parameters>. </ul>

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.

If the LimitExceededException is thrown, it is caused when the calling package exceeds the allowed rate limits and is throttled.

If the SecurityException is thrown, it is caused when the caller is not authorized or permission is not requested.

Java documentation for android.adservices.adselection.AdSelectionManager.selectAds(android.adservices.adselection.AdSelectionFromOutcomesConfig, java.util.concurrent.Executor, android.os.OutcomeReceiver<android.adservices.adselection.AdSelectionOutcome, java.lang.Exception>).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to