# TopicsManager

Artifact: [androidx.privacysandbox.ads:ads-adservices](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads) [View Source](https://cs.android.com/search?q=file:androidx/privacysandbox/ads/adservices/topics/TopicsManager.kt+class:androidx.privacysandbox.ads.adservices.topics.TopicsManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***


```
public abstract class TopicsManager
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_TOPICS") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager#getTopics(androidx.privacysandbox.ads.adservices.topics.GetTopicsRequest)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest request)` Return the topics. |
| `static final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager#obtain(android.content.Context)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html context)` Creates `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager`. |

## Public methods

### getTopics

```
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_TOPICS")
public abstract @NonNull GetTopicsResponse getTopics(@NonNull GetTopicsRequest request)
```

Return the topics.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/GetTopicsRequest request` | The GetTopicsRequest for obtaining Topics. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/GetTopicsResponse` | GetTopicsResponse |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException.html` | if caller is not authorized to call this API. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-illegal-state-exception/index.html` | if this API is not available. |
| `https://developer.android.com/reference/android/os/LimitExceededException.html` | if rate limit was reached. |

### obtain

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

```
public static final TopicsManager obtain(@NonNull Context context)
```

Creates `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager`.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/topics/TopicsManager` | TopicsManagerCompat object. If the device is running an incompatible build, the value returned is null. |