主題管理員
public
final
class
TopicsManager
extends Object
java.lang.Object | |
↳ | android.adservices.topics.TopicsManager |
TopicsManager 提供適用於應用程式和廣告 SDK 的 API,可透過保護隱私權的方式取得使用者興趣主題。
您可以使用 Context.getSystemService(Class)
和 TopicsManager
類別取得 TopicsManager
的例項。
摘要
公用方法 | |
---|---|
static
TopicsManager
|
get(Context context)
建立 TopicsManager 執行個體的工廠方法。 |
void
|
getTopics(GetTopicsRequest getTopicsRequest, Executor executor, OutcomeReceiver<GetTopicsResponse, Exception> callback)
傳回主題。 |
繼承方法 | |
---|---|
公用方法
get
public static TopicsManager get (Context context)
建立 TopicsManager 執行個體的工廠方法。
參數 | |
---|---|
context |
Context :要使用的 Context 不能為 null 。 |
傳回 | |
---|---|
TopicsManager |
TopicsManager 執行個體
此值不能為 null 。 |
getTopics
public void getTopics (GetTopicsRequest getTopicsRequest, Executor executor, OutcomeReceiver<GetTopicsResponse, Exception> callback)
傳回主題。
需求:AdServicesPermissions.ACCESS_ADSERVICES_TOPICS
參數 | |
---|---|
getTopicsRequest |
GetTopicsRequest :取得主題的要求。此值不能為 null 。 |
executor |
Executor :執行回呼的執行程式。此值不能為 null 。
回呼和事件監聽器會透過這個 Executor 分派,讓您輕鬆控制使用哪一個執行緒。如要透過應用程式的主要執行緒進行事件分派,可以使用 Context.getMainExecutor() 。否則,請提供會傳送至適當執行緒的 Executor 。 |
callback |
OutcomeReceiver :在主題可用或發生錯誤後呼叫的回呼。此值不能為 null 。 |
傳回 | |
---|---|
void |
此值不能為 null 。 |
擲回 | |
---|---|
IllegalStateException |
如果無法使用這個 API |