# AdData

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/privacysandbox/ads/adservices/common/AdData "View this page in Java")

<br />

```
class AdData
```

<br />

*** ** * ** ***

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

## Summary

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ### Public constructors                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String))`(renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`, metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`)` Represents data specific to an ad that is necessary for ad selection and rendering.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `@`[ExperimentalFeatures.Ext8OptIn](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext8OptIn) [AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String,kotlin.collections.Set,androidx.privacysandbox.ads.adservices.common.AdFilters))`(` ` renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`,` ` metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` adCounterKeys: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`>,` ` adFilters: `[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)`?` `)` Represents data specific to an ad that is necessary for ad selection and rendering.                                  |
| `@`[ExperimentalFeatures.Ext10OptIn](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/ExperimentalFeatures.Ext10OptIn) [AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#AdData(android.net.Uri,kotlin.String,kotlin.collections.Set,androidx.privacysandbox.ads.adservices.common.AdFilters,kotlin.String))`(` ` renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)`,` ` metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`,` ` adCounterKeys: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`>,` ` adFilters: `[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)`?,` ` adRenderId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?` `)` |

|                                        ### Public functions                                         |
|-----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html) | [equals](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#equals(kotlin.Any))`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` Checks whether two[AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData)objects contain the same information. |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                  | [hashCode](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#hashCode())`()` Returns the hash of the[AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData)object's data.                                                                                                              |
| `open `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)            | [toString](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#toString())`()` Overrides the toString method.                                                                                                                                                                                                                                  |

|                                                                          ### Public properties                                                                           |
|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`>` | [adCounterKeys](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#adCounterKeys()) the set of keys used in counting events                                                                                                                                     |
| [AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)`?`                                                   | [adFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#adFilters()) all[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)associated with the ad, it's optional and can be null as well |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`?`                                                                                     | [adRenderId](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#adRenderId()) ad render id for server auctions                                                                                                                                                  |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                        | [metadata](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#metadata()) buyer ad metadata represented as a JSON string                                                                                                                                        |
| [Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                                      | [renderUri](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData#renderUri()) a URI pointing to the ad's rendering assets                                                                                                                                         |

## Public constructors

### AdData

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

```
AdData(renderUri: Uri, metadata: String)
```

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

|                                          Parameters                                           |
|-----------------------------------------------------------------------------------------------|------------------------------------------------|
| `renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)              | a URI pointing to the ad's rendering assets    |
| `metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html) | 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
AdData(
    renderUri: Uri,
    metadata: String,
    adCounterKeys: Set<Int> = setOf(),
    adFilters: AdFilters? = null
)
```

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

|                                                                                             Parameters                                                                                              |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                                                    | a URI pointing to the ad's rendering assets                                                                                                  |
| `metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                       | buyer ad metadata represented as a JSON string                                                                                               |
| `adCounterKeys: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`> = setOf()` | the set of keys used in counting events                                                                                                      |
| `adFilters: `[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)`? = null`                                                          | all[AdFilters](https://developer.android.com/reference/kotlin/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
AdData(
    renderUri: Uri,
    metadata: String,
    adCounterKeys: Set<Int> = setOf(),
    adFilters: AdFilters? = null,
    adRenderId: String? = null
)
```  

|                                                                                             Parameters                                                                                              |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `renderUri: `[Uri](https://developer.android.com/reference/android/net/Uri.html)                                                                                                                    | a URI pointing to the ad's rendering assets                                                                                                                                         |
| `metadata: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                       | buyer ad metadata represented as a JSON string                                                                                                                                      |
| `adCounterKeys: `[Set](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-set/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`> = setOf()` | the set of keys used in counting events                                                                                                                                             |
| `adFilters: `[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)`? = null`                                                          | all[AdFilters](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdFilters)associated with the ad, it's optional and can be null as well |
| `adRenderId: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`? = null`                                                                                           | ad render id for server auctions                                                                                                                                                    |

## Public functions

### equals

```
open operator fun equals(other: Any?): Boolean
```

Checks whether two[AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData)objects contain the same information.  

### hashCode

```
open fun hashCode(): Int
```

Returns the hash of the[AdData](https://developer.android.com/reference/kotlin/androidx/privacysandbox/ads/adservices/common/AdData)object's data.  

### toString

```
open fun toString(): String
```

Overrides the toString method.  

## Public properties

### adCounterKeys

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

```
val adCounterKeys: Set<Int>
```

the set of keys used in counting events  

### adFilters

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

```
val adFilters: AdFilters?
```

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

### adRenderId

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

```
val adRenderId: String?
```

ad render id for server auctions  

### metadata

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

```
val metadata: String
```

buyer ad metadata represented as a JSON string  

### renderUri

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

```
val renderUri: Uri
```

a URI pointing to the ad's rendering assets