Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Also in[Ad Services Extensions 4](https://developer.android.com/sdkExtensions)  
Summary:[Ctors](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#pubctors)\|[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#pubmethods)\|[Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#inhmethods)  

# AdData.Builder

`
public
static
final

class
AdData.Builder
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.adservices.common.AdData.Builder |

<br />

*** ** * ** ***

Builder for[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)objects.

## Summary

|                                                          ### Public constructors                                                           ||
|-----------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#Builder())`() ` |

|                                                                                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` `[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)                 | ` `[build](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#build())`() ` Builds the[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)object.                                                                                                                                                                                                    |
| ` `[AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | ` `[setAdCounterKeys](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#setAdCounterKeys(java.util.Set<java.lang.Integer>))`(`[Set](https://developer.android.com/reference/java/util/Set)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`> adCounterKeys) ` Sets the set of keys used in counting events.                                                                          |
| ` `[AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | ` `[setAdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#setAdFilters(android.adservices.common.AdFilters))`(`[AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters)` adFilters) ` Sets all[AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters)associated with the ad. |
| ` `[AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | ` `[setAdRenderId](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#setAdRenderId(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` adRenderId) ` Sets the ad render id for server auction See[AdData#getAdRenderId()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdRenderId())for more information.     |
| ` `[AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | ` `[setMetadata](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#setMetadata(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` metadata) ` Sets the buyer ad metadata used during the ad selection process.                                                                                                                                                        |
| ` `[AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | ` `[setRenderUri](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder#setRenderUri(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri)` renderUri) ` Sets the URI that points to the ad's rendering assets.                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Public constructors

### Builder

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

```
public Builder ()
```

<br />

<br />

## Public methods

### build

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

```
public AdData build ()
```

Builds the[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)object.

<br />

|                                                                     Returns                                                                      ||
|--------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData) | This value cannot be`null`. <br /> |

|                                                                     Throws                                                                     ||
|------------------------------------------------------------------------------------------------|------------------------------------------------|
| [NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException) | if any required parameters are`null`when built |

### setAdCounterKeys

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public AdData.Builder setAdCounterKeys (Set<Integer> adCounterKeys)
```

Sets the set of keys used in counting events.

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

See[AdData.getAdCounterKeys()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdCounterKeys())for more information.

<br />

|                         Parameters                         ||
|-----------------|-------------------------------------------|
| `adCounterKeys` | `Set`: This value cannot be`null`. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | This value cannot be`null`. <br /> |

### setAdFilters

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public AdData.Builder setAdFilters (AdFilters adFilters)
```

Sets all[AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters)associated with the ad.

See[AdData.getAdFilters()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdFilters())for more information.

<br />

|                        Parameters                         ||
|-------------|----------------------------------------------|
| `adFilters` | `AdFilters`: This value may be`null`. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | This value cannot be`null`. <br /> |

### setAdRenderId

[**Added in Android UpsideDownCakePrivacySandbox**](https://developer.android.com/preview)  

```
public AdData.Builder setAdRenderId (String adRenderId)
```

Sets the ad render id for server auction

See[AdData#getAdRenderId()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdRenderId())for more information.

<br />

|                       Parameters                        ||
|--------------|-------------------------------------------|
| `adRenderId` | `String`: This value may be`null`. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | This value cannot be`null`. <br /> |

### setMetadata

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

```
public AdData.Builder setMetadata (String metadata)
```

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[AdData.getMetadata()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getMetadata())for detail.

<br />

|                        Parameters                        ||
|------------|----------------------------------------------|
| `metadata` | `String`: This value cannot be`null`. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | This value cannot be`null`. <br /> |

### setRenderUri

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

```
public AdData.Builder setRenderUri (Uri renderUri)
```

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

See[AdData.getRenderUri()](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getRenderUri())for detail.

<br />

|                       Parameters                       ||
|-------------|-------------------------------------------|
| `renderUri` | `Uri`: This value cannot be`null`. <br /> |

|                                                                             Returns                                                                              ||
|------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [AdData.Builder](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData.Builder) | This value cannot be`null`. <br /> |