TopicsManager
public final class TopicsManager
继承自 Object
java.lang.Object | |
↳ | android.adservices.topics.TopicsManager |
TopicsManager 提供了 API,供应用和广告 SDK 在保护用户隐私的方式下获取用户兴趣主题。
可以使用 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 不可用。 |