測試 AdSelectionManager
public
class
TestAdSelectionManager
extends Object
java.lang.Object | |
↳ | android.adservices.adselection.TestAdSelectionManager |
TestAdSelectionManager
可為應用程式和廣告 SDK 提供 API,以便測試廣告選擇程序。
這些 API 用於端對端測試。只有在手機搭載可進行偵錯的 OS 版本,且已啟用開發人員選項的情況下,才會針對可進行偵錯的應用程式啟用這些功能。
摘要
繼承方法 | |
---|---|
公用方法
覆寫 AdSelectionConfigRemoteInfo
public void overrideAdSelectionConfigRemoteInfo (AddAdSelectionOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
覆寫指定 AdSelectionConfig
的 AdSelection API,避免遠端伺服器擷取資料,並改用 AddAdSelectionOverrideRequest
中提供的資料。AddAdSelectionOverrideRequest
是由廣告 SDK 提供。
這個方法可用於端對端測試。只有處於偵錯模式的應用程式,並啟用開發人員選項,才會啟用這個 API。
需求:AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
參數 | |
---|---|
request |
AddAdSelectionOverrideRequest :此值不能為 null 。 |
executor |
Executor :此值不能為 null 。
回呼和事件監聽器會透過這個 Executor 分派,讓您輕鬆控制使用哪一個執行緒。如要透過應用程式的主要執行緒進行事件分派,可以使用 Context.getMainExecutor() 。否則,請提供會傳送至適當執行緒的 Executor 。 |
receiver |
OutcomeReceiver :此值不能為 null 。 |
擲回 | |
---|---|
IllegalStateException |
如果呼叫端尚未啟用這個 API,
接收器如果成功執行,會傳回 |
覆寫 AdSelectionFromOutcomesConfigRemoteInfo
public void overrideAdSelectionFromOutcomesConfigRemoteInfo (AddAdSelectionFromOutcomesOverrideRequest request, Executor executor, OutcomeReceiver<Object, Exception> receiver)
覆寫 AdSelectionFromOutcomesConfig
的 AdSelection API,避免從遠端伺服器擷取資料,改為使用 AddAdSelectionFromOutcomesOverrideRequest
中提供的資料。AddAdSelectionFromOutcomesOverrideRequest
是由廣告 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 中與 RemoveAdSelectionOverrideRequest
資料相關聯的 AdSelectionConfig
覆寫。RemoveAdSelectionOverrideRequest
是由廣告 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 中與 RemoveAdSelectionOverrideRequest
資料相關聯的 AdSelectionFromOutcomesConfig
覆寫值。RemoveAdSelectionOverrideRequest
是由廣告 SDK 提供。
這個方法可用於端對端測試。只有處於偵錯模式的應用程式,並啟用開發人員選項,才會啟用這個 API。
需求:AdServicesPermissions.ACCESS_ADSERVICES_CUSTOM_AUDIENCE
參數 | |
---|---|
request |
RemoveAdSelectionFromOutcomesOverrideRequest :此值不能為 null 。 |
executor |
Executor :此值不能為 null 。
回呼和事件監聽器會透過這個 Executor 分派,讓您輕鬆控制使用哪一個執行緒。如要透過應用程式的主要執行緒進行事件分派,可以使用 Context.getMainExecutor() 。否則,請提供會傳送至適當執行緒的 Executor 。 |
receiver |
OutcomeReceiver :此值不能為 null 。 |
擲回 | |
---|---|
IllegalStateException |
如果呼叫端尚未啟用這個 API,
接收器如果成功執行,會傳回 |
重設 AllAdSelectionConfigRemoteOverrides
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,
接收器如果成功執行,會傳回 |
重設 AllAdSelectionFromOutcomesConfigRemoteOverrides
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,
接收器如果成功執行,會傳回 |