TestAdSelectionManager
public class TestAdSelectionManager
extends Object
java.lang.Object | |
↳ | android.adservices.adselection.TestAdSelectionManager |
TestAdSelectionManager
提供了 API,供应用和广告 SDK 测试广告选择流程。
这些 API 旨在用于端到端测试。仅对在启用了开发者选项的可调试 OS 版本手机上运行的可调试应用启用这些 API。
摘要
继承的方法 | |
---|---|
公共方法
overrideAdSelectionConfigRemoteInfo
public void overrideAdSelectionConfigRemoteInfo (AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
对于给定的 AdSelectionConfig
,替换 AdSelection API,以避免从远程服务器获取数据,而改用 AddAdSelectionOverrideRequest
中提供的数据。AddAdSelectionOverrideRequest
由 Ads SDK 提供。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
request |
AddAdSelectionOverrideRequest :此值不能为 null 。 |
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |
overrideAdSelectionFromOutcomesConfigRemoteInfo
public void overrideAdSelectionFromOutcomesConfigRemoteInfo (AddAdSelectionFromOutcomesOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
对于 AdSelectionFromOutcomesConfig
,替换 AdSelection API,以避免从远程服务器获取数据,而改用 AddAdSelectionFromOutcomesOverrideRequest
中提供的数据。AddAdSelectionFromOutcomesOverrideRequest
由 Ads SDK 提供。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
request |
AddAdSelectionFromOutcomesOverrideRequest :此值不能为 null 。 |
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |
removeAdSelectionConfigRemoteInfoOverride
public void removeAdSelectionConfigRemoteInfoOverride (RemoveAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
移除 Ad Selection API 中 AdSelectionConfig
的替换设置,并删除与 RemoveAdSelectionOverrideRequest
中关联的数据。RemoveAdSelectionOverrideRequest
由 Ads SDK 提供。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
request |
RemoveAdSelectionOverrideRequest :此值不能为 null 。 |
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |
removeAdSelectionFromOutcomesConfigRemoteInfoOverride
public void removeAdSelectionFromOutcomesConfigRemoteInfoOverride (RemoveAdSelectionFromOutcomesOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
移除 Ad Selection API 中 AdSelectionFromOutcomesConfig
的替换设置,并删除与 RemoveAdSelectionOverrideRequest
中关联的数据。RemoveAdSelectionOverrideRequest
由 Ads SDK 提供。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
request |
RemoveAdSelectionFromOutcomesOverrideRequest :此值不能为 null 。 |
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |
resetAllAdSelectionConfigRemoteOverrides
public void resetAllAdSelectionConfigRemoteOverrides (Executor executor, OutcomeReceiver<Object, Exception> receiver)
移除 Ad Selection API 中 AdSelectionConfig
的所有替换数据。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |
resetAllAdSelectionFromOutcomesConfigRemoteOverrides
public void resetAllAdSelectionFromOutcomesConfigRemoteOverrides (Executor executor, OutcomeReceiver<Object, Exception> receiver)
移除 Ad Selection API 中 AdSelectionFromOutcomesConfig
的所有替换数据。
此方法旨在用于端到端测试。此 API 仅对在启用了开发者选项的调试模式下运行的应用启用。
需要 AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
参数 | |
---|---|
executor |
Executor :此值不能为 null 。通过此 Executor 分派回调和监听器事件,以便轻松控制使用哪个线程。要通过应用的主线程分派事件,可以使用 Context.getMainExecutor() 。否则,请提供一个分派到适当线程的 Executor 。 |
receiver |
OutcomeReceiver :此值不能为 null 。 |
抛出 | |
---|---|
IllegalStateException |
如果此 API 未对调用方启用 接收方在成功运行时返回 |