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:[Nested Classes](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#nestedclasses)\|[Inherited Constants](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#inhconstants)\|[Fields](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#lfields)\|[Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#pubmethods)\|[Inherited Methods](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#inhmethods)  

# AdData

`
public

final

class
AdData
`  
`

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


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

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

<br />

*** ** * ** ***

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

## Summary

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

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| |
| From interface[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with[describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with[writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

|                                                                                                                                                                       ### Fields                                                                                                                                                                        ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)`>` | [CREATOR](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#CREATOR) <br /> |

|                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                         ||
|-------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` boolean`                                                                                                                                | ` `[equals](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` o) ` Checks whether two[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)objects contain the same information. |
| ` `[Set](https://developer.android.com/reference/java/util/Set)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`>` | ` `[getAdCounterKeys](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdCounterKeys())`() ` Gets the set of keys used in counting events.                                                                                                                                                                                         |
| ` `[AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters)                     | ` `[getAdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdFilters())`() ` Gets all[AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters)associated with the ad.                                                                                             |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                     | ` `[getAdRenderId](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getAdRenderId())`() ` Gets the ad render id for server auctions.                                                                                                                                                                                                  |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                     | ` `[getMetadata](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getMetadata())`() ` Gets the buyer ad metadata used during the ad selection process.                                                                                                                                                                                |
| ` `[Uri](https://developer.android.com/reference/android/net/Uri)                                                                         | ` `[getRenderUri](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#getRenderUri())`() ` Gets the URI that points to the ad's rendering assets.                                                                                                                                                                                        |
| ` int`                                                                                                                                    | ` `[hashCode](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#hashCode())`() ` Returns the hash of the[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)object's data.                                                                                                     |
| ` `[String](https://developer.android.com/reference/java/lang/String)                                                                     | ` `[toString](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                        |
| ` void`                                                                                                                                   | ` `[writeToParcel](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel.                                                                                            |

| ### 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*.                                                                                             | ||
| From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Fields

### CREATOR

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 static final Creator<AdData> CREATOR
```

<br />

<br />

## Public methods

### equals

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

```
public boolean equals (Object o)
```

Checks whether two[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)objects contain the same information.

<br />

|                            Parameters                             ||
|-----|--------------------------------------------------------------|
| `o` | `Object`: the reference object with which to compare. <br /> |

|                                         Returns                                          ||
|-----------|-------------------------------------------------------------------------------|
| `boolean` | `true`if this object is the same as the obj argument;`false`otherwise. <br /> |

### getAdCounterKeys

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

```
public Set<Integer> getAdCounterKeys ()
```

Gets the set of keys used in counting events.

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

The keys and counts per key are used in frequency cap filtering during ad selection to disqualify associated ads from being submitted to bidding.

Note that these keys can be overwritten along with the ads and other bidding data for a custom audience during the custom audience's daily update.

<br />

|                                                                                  Returns                                                                                   ||
|----------------------------------------------------------------------------------------------------------------------------------------|------------------------------------|
| [Set](https://developer.android.com/reference/java/util/Set)`<`[Integer](https://developer.android.com/reference/java/lang/Integer)`>` | This value cannot be`null`. <br /> |

### getAdFilters

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

```
public AdFilters getAdFilters ()
```

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

The filters, if met or exceeded, exclude the associated ad from participating in ad selection. They are optional and if`null`specify that no filters apply to this ad.

<br />

|                                                          Returns                                                           ||
|--------------------------------------------------------------------------------------------------------------------|--------|
| [AdFilters](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdFilters) | <br /> |

### getAdRenderId

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

```
public String getAdRenderId ()
```

Gets the ad render id for server auctions.

Ad render id is collected for each[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)when server auction request is received.

Any[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)without ad render id will be ineligible for server-side auction.

<br />

|                                               Returns                                               ||
|--------------------------------------------------------------------|---------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | This value may be`null`. <br /> |

### getMetadata

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 String getMetadata ()
```

Gets 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.

<br />

|                                                Returns                                                 ||
|--------------------------------------------------------------------|------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | This value cannot be`null`. <br /> |

### getRenderUri

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 Uri getRenderUri ()
```

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

<br />

|                                              Returns                                               ||
|----------------------------------------------------------------|------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri) | This value cannot be`null`. <br /> |

### hashCode

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

```
public int hashCode ()
```

Returns the hash of the[AdData](https://developer.android.com/design-for-safety/privacy-sandbox/reference/adservices/common/AdData)object's data.

<br />

|                     Returns                      ||
|-------|-------------------------------------------|
| `int` | a hash code value for this object. <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object. In general, the`toString`method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The`toString`method for class`Object`returns a string consisting of the name of the class of which the object is an instance, the at-sign character \``@`', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:
>
> ```
>  getClass().getName() + '@' + Integer.toHexString(hashCode())
>  
> ```

<br />

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | `Parcel`: This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either`0`or a combination of[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |