Stay organized with collections
Save and categorize content based on your preferences.
TopicsManager
class 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 android.content.Context#getSystemService and TopicsManager
class.
Summary
Public methods |
static TopicsManager |
Factory method for creating an instance of TopicsManager.
|
Unit |
Return the topics.
|
Public methods
get
static fun get(context: Context): TopicsManager
Factory method for creating an instance of TopicsManager.
Parameters |
context |
Context: The Context to use This value cannot be null . |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# TopicsManager\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)\n\nTopicsManager\n=============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/adservices/topics/TopicsManager \"View this page in Java\") \n\n```\nclass TopicsManager\n```\n\n|---|----------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.adservices.topics.TopicsManager](#) |\n\nTopicsManager provides APIs for App and Ad-Sdks to get the user interest topics in a privacy preserving way.\n\nThe instance of the [TopicsManager](#) can be obtained using android.content.Context#getSystemService and [TopicsManager](#) class.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| static [TopicsManager](#) | [get](#get(android.content.Context))`(`context:` `[Context](../../content/Context.html#)`)` Factory method for creating an instance of TopicsManager. |\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [getTopics](#getTopics(android.adservices.topics.GetTopicsRequest,%20java.util.concurrent.Executor,%20android.os.OutcomeReceiver))`(`getTopicsRequest:` `[GetTopicsRequest](/reference/kotlin/android/adservices/topics/GetTopicsRequest)`, `executor:` `[Executor](../../../java/util/concurrent/Executor.html#)`, `callback:` `[OutcomeReceiver](../../os/OutcomeReceiver.html#)\u003c[GetTopicsResponse](/reference/kotlin/android/adservices/topics/GetTopicsResponse)!,` `[Exception](../../../java/lang/Exception.html#)!\u003e`)` Return the topics. |\n\nPublic methods\n--------------\n\n### get\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 6](https://developer.android.com/sdkExtensions) \n\n```\nstatic fun get(context: Context): TopicsManager\n```\n\nFactory method for creating an instance of TopicsManager.\n\n| Parameters ||\n|-----------|------------------------------------------------------------------------------------------------------------------------|\n| `context` | [Context](../../content/Context.html#): The [Context](../../content/Context.html#) to use This value cannot be `null`. |\n\n| Return ||\n|--------------------|------------------------------------------------------------|\n| [TopicsManager](#) | A [TopicsManager](#) instance This value cannot be `null`. |\n\n### getTopics\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nAlso in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions) \n\n```\nfun getTopics(\n getTopicsRequest: GetTopicsRequest, \n executor: Executor, \n callback: OutcomeReceiver\u003cGetTopicsResponse!, Exception!\u003e\n): Unit\n```\n\nReturn the topics. \nRequires [android.adservices.common.AdServicesPermissions#ACCESS_ADSERVICES_TOPICS](../common/AdServicesPermissions.html#ACCESS_ADSERVICES_TOPICS:kotlin.String)\n\n| Parameters ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `getTopicsRequest` | [GetTopicsRequest](/reference/kotlin/android/adservices/topics/GetTopicsRequest): The request for obtaining Topics. This value cannot be `null`. |\n| `executor` | [Executor](../../../java/util/concurrent/Executor.html#): The executor to run callback. This value cannot be `null`. Callback and listener events are dispatched through this [Executor](../../../java/util/concurrent/Executor.html#), 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()](../../content/Context.html#getMainExecutor()). Otherwise, provide an [Executor](../../../java/util/concurrent/Executor.html#) that dispatches to an appropriate thread. |\n| `callback` | [OutcomeReceiver](../../os/OutcomeReceiver.html#)\\\u003c[GetTopicsResponse](/reference/kotlin/android/adservices/topics/GetTopicsResponse)!, [Exception](../../../java/lang/Exception.html#)!\\\u003e: The callback that's called after topics are available or an error occurs. This value cannot be `null`. |\n\n| Return ||\n|------------------------------------------------------------------------------|------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------------------|-------------------------------|\n| `java.lang.IllegalStateException` | if this API is not available. |"]]