Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Builder

*** ** * ** ***

```
class Builder
```

|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||
| ↳ | [android.adservices.common.AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) |

*** ** * ** ***

> [!CAUTION]
> **This class was deprecated in API level 37.**
>
> The Rubidium (Rb) Relevance APIs, including those in android.adservices.common, are being deprecated. Relevance APIs have no direct replacement. Developers should stop using them, as calls will be rejected in future Android releases. Please refer to official Privacy Sandbox documentation for deprecation and roadmap details: https://privacysandbox.com/news/update-on-plans-for-privacy-sandbox-technologies/

Builder for `https://developer.android.com/reference/kotlin/android/adservices/common/AdData` objects.

## Summary

| Public constructors ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#Builder()()` <br /> |

| Public methods ||
|---|---|
| [AdData](https://developer.android.com/reference/kotlin/android/adservices/common/AdData) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#build()()` Builds the `https://developer.android.com/reference/kotlin/android/adservices/common/AdData` object. |
| [AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#setAdCounterKeys(kotlin.collections.MutableSet)(adCounterKeys: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html<https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html!>)` Sets the set of keys used in counting events. |
| [AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#setAdFilters(android.adservices.common.AdFilters)(adFilters: https://developer.android.com/reference/kotlin/android/adservices/common/AdFilters?)` Sets all `https://developer.android.com/reference/kotlin/android/adservices/common/AdFilters` associated with the ad. |
| [AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#setAdRenderId(kotlin.String)(adRenderId: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html?)` Sets the ad render id for server auction |
| [AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#setMetadata(kotlin.String)(metadata: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)` Sets the buyer ad metadata used during the ad selection process. |
| [AdData.Builder](https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#) | `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#setRenderUri(android.net.Uri)(renderUri: https://developer.android.com/reference/kotlin/android/net/Uri.html#)` Sets the URI that points to the ad's rendering assets. |

## Public constructors

### Builder

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)

```
Builder()
```

## Public methods

### build

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun build(): AdData
```

**Deprecated:** *Deprecated in Java.*

Builds the `https://developer.android.com/reference/kotlin/android/adservices/common/AdData` object.

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData` | This value cannot be `null`. |

| Exceptions ||
|---|---|
| `java.lang.NullPointerException` | if any required parameters are `null` when built |

### setAdCounterKeys

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setAdCounterKeys(adCounterKeys: MutableSet<Int!>): AdData.Builder
```

**Deprecated:** *Deprecated in Java.*

Sets the set of keys used in counting events.

No more than 10 ad counter keys may be associated with an ad.

See `https://developer.android.com/reference/kotlin/android/adservices/common/AdData#getAdCounterKeys()` for more information.

| Parameters ||
|---|---|
| `adCounterKeys` | [MutableSet](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.collections/-mutable-set/index.html)\<[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)!\>: This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#` | This value cannot be `null`. |

### setAdFilters

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 8](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setAdFilters(adFilters: AdFilters?): AdData.Builder
```

**Deprecated:** *Deprecated in Java.*

Sets all `https://developer.android.com/reference/kotlin/android/adservices/common/AdFilters` associated with the ad.

See `https://developer.android.com/reference/kotlin/android/adservices/common/AdData#getAdFilters()` for more information.

| Parameters ||
|---|---|
| `adFilters` | [AdFilters](https://developer.android.com/reference/kotlin/android/adservices/common/AdFilters)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#` | This value cannot be `null`. |

### setAdRenderId

Added in [API level 35](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 10](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setAdRenderId(adRenderId: String?): AdData.Builder
```

**Deprecated:** *Deprecated in Java.*

Sets the ad render id for server auction

See `https://developer.android.com/reference/kotlin/android/adservices/common/AdData#getAdRenderId()` for more information.

| Parameters ||
|---|---|
| `adRenderId` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)?: This value may be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#` | This value cannot be `null`. |

### setMetadata

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setMetadata(metadata: String): AdData.Builder
```

**Deprecated:** *Deprecated in Java.*

Sets the buyer ad metadata used during the ad selection process.

The metadata should be a valid JSON object serialized as a string. Metadata represents ad-specific bidding information that will be used during ad selection as part of bid generation and used in buyer JavaScript logic, which is executed in an isolated execution environment.

If the metadata is not a valid JSON object that can be consumed by the buyer's JS, the ad will not be eligible for ad selection.

See `https://developer.android.com/reference/kotlin/android/adservices/common/AdData#getMetadata()` for detail.

| Parameters ||
|---|---|
| `metadata` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#` | This value cannot be `null`. |

### setRenderUri

Added in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Also in [Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
fun setRenderUri(renderUri: Uri): AdData.Builder
```

**Deprecated:** *Deprecated in Java.*

Sets the URI that points to the ad's rendering assets. The URI must use HTTPS.

See `https://developer.android.com/reference/kotlin/android/adservices/common/AdData#getRenderUri()` for detail.

| Parameters ||
|---|---|
| `renderUri` | [Uri](https://developer.android.com/reference/kotlin/android/net/Uri.html#): This value cannot be `null`. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/adservices/common/AdData.Builder#` | This value cannot be `null`. |