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
Constants | |
---|---|
String |
AD_SELECTION_SERVICE
|
Public methods | |
---|---|
void
|
overrideAdSelectionConfigRemoteInfo(AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> receiver)
Overrides the AdSelection API to avoid fetching data from remote servers and use the data
provided in |
void
|
removeAdSelectionConfigRemoteInfoOverride(RemoveAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> receiver)
Removes an override in th Ad Selection API with associated the data in |
void
|
reportImpression(ReportImpressionRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> receiver)
Report the given impression. |
void
|
resetAllAdSelectionConfigRemoteOverrides(Executor executor, OutcomeReceiver<Void, AdServicesException> receiver)
Removes all override data in the Ad Selection API. |
void
|
runAdSelection(AdSelectionConfig adSelectionConfig, Executor executor, OutcomeReceiver<AdSelectionOutcome, AdServicesException> receiver)
Runs the ad selection process on device to select a remarketing ad for the caller application. |
Inherited methods | |
---|---|
Constants
AD_SELECTION_SERVICE
public static final String AD_SELECTION_SERVICE
Constant Value: "ad_selection_service"
Public methods
overrideAdSelectionConfigRemoteInfo
public void overrideAdSelectionConfigRemoteInfo (AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> 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.
Parameters | |
---|---|
request |
AddAdSelectionOverrideRequest : 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 . |
Throws | |
---|---|
IllegalStateException |
if this API is not enabled for the caller
The receiver either returns a |
removeAdSelectionConfigRemoteInfoOverride
public void removeAdSelectionConfigRemoteInfoOverride (RemoveAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> receiver)
Removes an override in the 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.
Parameters | |
---|---|
request |
RemoveAdSelectionOverrideRequest : 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 . |
Throws | |
---|---|
IllegalStateException |
if this API is not enabled for the caller
The receiver either returns a |
reportImpression
public void reportImpression (ReportImpressionRequest request, Executor executor, OutcomeReceiver<Void, AdServicesException> 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 AdServicesException
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 . |
resetAllAdSelectionConfigRemoteOverrides
public void resetAllAdSelectionConfigRemoteOverrides (Executor executor, OutcomeReceiver<Void, AdServicesException> 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.
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 . |
Returns | |
---|---|
void |
This value cannot be null . |
Throws | |
---|---|
IllegalStateException |
if this API is not enabled for the caller
The receiver either returns a |
runAdSelection
public void runAdSelection (AdSelectionConfig adSelectionConfig, Executor executor, OutcomeReceiver<AdSelectionOutcome, AdServicesException> 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 AdServicesException
includes the type of the exception thrown
and the corresponding error message.
If the result of the AdServicesException#getCause
is an IllegalArgumentException
, it is caused by invalid input argument the API received to run the
ad selection.
If the result of the AdServicesException#getCause
is an RemoteException
with
error message "Failure of AdSelection services.", it is caused by an internal failure of the
ad selection service.
Parameters | |
---|---|
adSelectionConfig |
AdSelectionConfig : This value cannot be null . |
executor |
Executor : This value cannot be null . |
receiver |
OutcomeReceiver : This value cannot be null . |