TopicsManager


public final class TopicsManager
extends Object

java.lang.Object
   ↳ android.adservices.topics.TopicsManager


TopicsManager provides APIs for App and Ad-Sdks to get the user interest topics in a privacy preserving way.

The instance of the TopicsManager can be obtained using Context.getSystemService(Class) and TopicsManager class.

Summary

Public methods

static TopicsManager get(Context context)

Factory method for creating an instance of TopicsManager.

void getTopics(GetTopicsRequest getTopicsRequest, Executor executor, OutcomeReceiver<GetTopicsResponseException> callback)

Return the topics.

Inherited methods

Public methods

get

public static TopicsManager get (Context context)

Factory method for creating an instance of TopicsManager.

Parameters
context Context: The Context to use This value cannot be null.

Returns
TopicsManager A TopicsManager instance This value cannot be null.

getTopics

public void getTopics (GetTopicsRequest getTopicsRequest, 
                Executor executor, 
                OutcomeReceiver<GetTopicsResponseException> callback)

Return the topics.
Requires AdServicesPermissions.ACCESS_ADSERVICES_TOPICS

Parameters
getTopicsRequest GetTopicsRequest: The request for obtaining Topics. This value cannot be null.

executor Executor: The executor to run callback. 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.

callback OutcomeReceiver: The callback that's called after topics are available or an error occurs. This value cannot be null.

Returns
void This value cannot be null.

Throws
IllegalStateException if this API is not available.