# AdIdManager

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/adid/AdIdManager.kt+class:androidx.privacysandbox.ads.adservices.adid.AdIdManager) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/privacysandbox-ads#1.0.0)

*** ** * ** ***


```
public abstract class AdIdManager
```

<br />

*** ** * ** ***

AdId Manager provides APIs for app and ad-SDKs to access advertising ID. The advertising ID is a unique, per-device, user-resettable ID for advertising. It gives users better controls and provides developers with a simple, standard system to continue to monetize their apps via personalized ads (formerly known as interest-based ads).

## Summary

| ### Public methods |
|---|---|
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adid/AdId` | `@https://developer.android.com/reference/androidx/annotation/RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_AD_ID") https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adid/AdIdManager#getAdId()()` Return the AdId. |
| `static final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adid/AdIdManager` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adid/AdIdManager#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/adid/AdIdManager`. |

## Public methods

### getAdId

```
@RequiresPermission(value = "android.permission.ACCESS_ADSERVICES_AD_ID")
public abstract @NonNull AdId getAdId()
```

Return the AdId.

| 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 AdIdManager obtain(@NonNull Context context)
```

Creates `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/adid/AdIdManager`.

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