# AdData

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

*** ** * ** ***


```
public final class AdData
```

<br />

*** ** * ** ***

Represents data specific to an ad that is necessary for ad selection and rendering.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata)` Represents data specific to an ad that is necessary for ad selection and rendering. |
| `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext8OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String,kotlin.collections.Set,androidx.privacysandbox.ads.adservices.common.AdFilters)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> adCounterKeys, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters adFilters )` Represents data specific to an ad that is necessary for ad selection and rendering. |
| `@https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext10OptIn https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String,kotlin.collections.Set,androidx.privacysandbox.ads.adservices.common.AdFilters,kotlin.String)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> adCounterKeys, https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters adFilters, https://developer.android.com/reference/java/lang/String.html adRenderId )` |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#equals(kotlin.Any)(https://developer.android.com/reference/java/lang/Object.html other)` Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects contain the same information. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html>` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#getAdCounterKeys()()` the set of keys used in counting events |
| `final https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#getAdFilters()()` all `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters` associated with the ad, it's optional and can be null as well |
| `final https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#getAdRenderId()()` ad render id for server auctions |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#getMetadata()()` buyer ad metadata represented as a JSON string |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#getRenderUri()()` a URI pointing to the ad's rendering assets |
| `int` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#hashCode()()` Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` object's data. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData#toString()()` Overrides the toString method. |

## Public constructors

### AdData

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

```
public AdData(@NonNull Uri renderUri, @NonNull String metadata)
```

Represents data specific to an ad that is necessary for ad selection and rendering.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri` | a URI pointing to the ad's rendering assets |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata` | buyer ad metadata represented as a JSON string |

### AdData

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

```
@ExperimentalFeatures.Ext8OptIn
public AdData(
    @NonNull Uri renderUri,
    @NonNull String metadata,
    @NonNull Set<@NonNull Integer> adCounterKeys,
    AdFilters adFilters
)
```

Represents data specific to an ad that is necessary for ad selection and rendering.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri` | a URI pointing to the ad's rendering assets |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata` | buyer ad metadata represented as a JSON string |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> adCounterKeys` | the set of keys used in counting events |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters adFilters` | all `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters` associated with the ad |

### AdData

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

```
@ExperimentalFeatures.Ext10OptIn
public AdData(
    @NonNull Uri renderUri,
    @NonNull String metadata,
    @NonNull Set<@NonNull Integer> adCounterKeys,
    AdFilters adFilters,
    String adRenderId
)
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/net/Uri.html renderUri` | a URI pointing to the ad's rendering assets |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html metadata` | buyer ad metadata represented as a JSON string |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Set.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html> adCounterKeys` | the set of keys used in counting events |
| `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters adFilters` | all `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters` associated with the ad, it's optional and can be null as well |
| `https://developer.android.com/reference/java/lang/String.html adRenderId` | ad render id for server auctions |

## Public methods

### equals

```
public boolean equals(Object other)
```

Checks whether two `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` objects contain the same information.

### getAdCounterKeys

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

```
public final @NonNull Set<@NonNull Integer> getAdCounterKeys()
```

the set of keys used in counting events

### getAdFilters

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

```
public final AdFilters getAdFilters()
```

all `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdFilters` associated with the ad, it's optional and can be null as well

### getAdRenderId

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

```
public final String getAdRenderId()
```

ad render id for server auctions

### getMetadata

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

```
public final @NonNull String getMetadata()
```

buyer ad metadata represented as a JSON string

### getRenderUri

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

```
public final @NonNull Uri getRenderUri()
```

a URI pointing to the ad's rendering assets

### hashCode

```
public int hashCode()
```

Returns the hash of the `https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData` object's data.

### toString

```
public @NonNull String toString()
```

Overrides the toString method.