AdData.Builder


public static final class AdData.Builder
extends Object

java.lang.Object
   ↳ android.adservices.common.AdData.Builder


Builder for AdData objects.

Summary

Public constructors

Builder()

Public methods

AdData build()

Builds the AdData object.

AdData.Builder setAdCounterKeys(Set<Integer> adCounterKeys)

Sets the set of keys used in counting events.

AdData.Builder setAdFilters(AdFilters adFilters)

Sets all AdFilters associated with the ad.

AdData.Builder setAdRenderId(String adRenderId)

Sets the ad render id for server auction

See AdData.getAdRenderId() for more information.

AdData.Builder setMetadata(String metadata)

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

AdData.Builder setRenderUri(Uri renderUri)

Sets the URI that points to the ad's rendering assets.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public AdData build ()

Builds the AdData object.

Returns
AdData This value cannot be null.

Throws
NullPointerException if any required parameters are null when built

setAdCounterKeys

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() for more information.

Parameters
adCounterKeys Set: This value cannot be null.

Returns
AdData.Builder This value cannot be null.

setAdFilters

public AdData.Builder setAdFilters (AdFilters adFilters)

Sets all AdFilters associated with the ad.

See AdData.getAdFilters() for more information.

Parameters
adFilters AdFilters: This value may be null.

Returns
AdData.Builder This value cannot be null.

setAdRenderId

public AdData.Builder setAdRenderId (String adRenderId)

Sets the ad render id for server auction

See AdData.getAdRenderId() for more information.

Parameters
adRenderId String: This value may be null.

Returns
AdData.Builder This value cannot be null.

setMetadata

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() for detail.

Parameters
metadata String: This value cannot be null.

Returns
AdData.Builder This value cannot be null.

setRenderUri

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() for detail.

Parameters
renderUri Uri: This value cannot be null.

Returns
AdData.Builder This value cannot be null.