BannerSignalRequest.Builder

public final class BannerSignalRequest.Builder


A builder class for creating BannerSignalRequest.

Summary

Public constructors

Builder(@NonNull String signalType)

Gets a Builder for BannerSignalRequest.

Public methods

final @NonNull BannerSignalRequest.Builder

Sets a slot-level ad category exclusion label.

final @NonNull BannerSignalRequest.Builder

Adds a keyword for targeting purposes.

final @NonNull BannerSignalRequest

Constructs a BannerSignalRequest with the specified attributes.

final @NonNull BannerSignalRequest.Builder

Adds extra parameters to pass to a specific ad source adapter.

final @NonNull BannerSignalRequest.Builder

Adds a custom targeting parameter.

final @NonNull BannerSignalRequest.Builder

Adds a custom targeting parameter with multiple values.

final @NonNull BannerSignalRequest.Builder

Sets the AdSize and overwrites any list of ad sizes passed in setAdSizes.

final @NonNull BannerSignalRequest.Builder

Sets a list of valid AdSizes and overwrites the ad size passed in setAdSize with the first size in the list.

final @NonNull BannerSignalRequest.Builder

Sets the ad unit ID.

final @NonNull BannerSignalRequest.Builder

Sets the content URL for a web site whose content matches the app's primary content.

final @NonNull BannerSignalRequest.Builder

Set extra parameters to pass to AdMob or Ad Manager.

@NonNull BannerSignalRequest.Builder

Indicates whether you intend to record impressions manually for the BannerAd.

final @NonNull BannerSignalRequest.Builder

Sets URLs representing web content near an ad.

final @NonNull BannerSignalRequest.Builder

Sets an identifier for use in frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

final @NonNull BannerSignalRequest.Builder

Sets the request agent string to identify the ad request's origin.

@NonNull BannerSignalRequest.Builder

Sets the VideoOptions for this request.

Public constructors

Builder

public Builder(@NonNull String signalType)

Gets a Builder for BannerSignalRequest.

Public methods

addCategoryExclusion

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder addCategoryExclusion(@NonNull String categoryExclusion)

Sets a slot-level ad category exclusion label.

This feature is only applicable for Ad Manager ad requests. Any category exclusions will be ignored on AdMob requests.

addKeyword

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder addKeyword(@NonNull String keyword)

Adds a keyword for targeting purposes.

build

public final @NonNull BannerSignalRequest build()

Constructs a BannerSignalRequest with the specified attributes.

putAdSourceExtrasBundle

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder putAdSourceExtrasBundle(
    @NonNull Class<@NonNull MediationExtrasReceiver> adapterClass,
    @NonNull Bundle adSourceExtras
)

Adds extra parameters to pass to a specific ad source adapter.

Parameters
@NonNull Class<@NonNull MediationExtrasReceiver> adapterClass

The Class of the adapter that should receive extras.

@NonNull Bundle adSourceExtras

A Bundle of extra information to pass to a mediation adapter.

putCustomTargeting

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder putCustomTargeting(@NonNull String key, @NonNull String value)

Adds a custom targeting parameter. Calling this a second time with the same key will overwrite the old values.

This feature is only applicable for Ad Manager ad requests. Any custom targeting will be ignored on AdMob requests.

putCustomTargeting

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder putCustomTargeting(
    @NonNull String key,
    @NonNull List<@NonNull String> values
)

Adds a custom targeting parameter with multiple values. Calling this a second time with the same key will overwrite the old values.

This feature is only applicable for Ad Manager ad requests. AdMob requests currently ignore custom targeting.

setAdSize

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setAdSize(@NonNull AdSize adSize)

Sets the AdSize and overwrites any list of ad sizes passed in setAdSizes.

setAdSizes

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setAdSizes(@NonNull List<@NonNull AdSize> adSizes)

Sets a list of valid AdSizes and overwrites the ad size passed in setAdSize with the first size in the list.

This feature is available to Ad Manager publishers only. AdMob publishers should use setAdSize instead.

setAdUnitId

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setAdUnitId(@NonNull String adUnitId)

Sets the ad unit ID.

setContentUrl

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setContentUrl(@NonNull String contentUrl)

Sets the content URL for a web site whose content matches the app's primary content. This web site content is used for targeting and brand safety purposes.

Throws
java.lang.IllegalArgumentException

If contentUrl is empty.

setGoogleExtrasBundle

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setGoogleExtrasBundle(@NonNull Bundle extraBundle)

Set extra parameters to pass to AdMob or Ad Manager. Calling this a second time will overwrite the old values.

Parameters
@NonNull Bundle extraBundle

A Bundle of extra information to pass to AdMob or Ad Manager.

setManualImpressionEnabled

@CanIgnoreReturnValue
public @NonNull BannerSignalRequest.Builder setManualImpressionEnabled(boolean enabled)

Indicates whether you intend to record impressions manually for the BannerAd. Use BannerAd.recordManualImpression to record impressions manually.

setNeighboringContentUrls

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setNeighboringContentUrls(
    @NonNull Set<@NonNull String> neighboringContentUrls
)

Sets URLs representing web content near an ad. Promotes brand safety and allows displayed ads to have an app level rating (MA, T, PG, etc) that is more appropriate to neighboring content.

Parameters
@NonNull Set<@NonNull String> neighboringContentUrls

The set of neighboring content URLs to be attached to the existing neighboring content URLs.

setPublisherProvidedId

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setPublisherProvidedId(@NonNull String publisherProvidedId)

Sets an identifier for use in frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

This feature is only applicable for Ad Manager ad requests. Any ID will be ignored on AdMob requests.

setRequestAgent

@CanIgnoreReturnValue
public final @NonNull BannerSignalRequest.Builder setRequestAgent(@NonNull String requestAgent)

Sets the request agent string to identify the ad request's origin. Third party libraries that implement the Mobile Ads SDK on behalf of publishers should call this method to denote the platform from which the ad request originated.

setVideoOptions

@CanIgnoreReturnValue
public @NonNull BannerSignalRequest.Builder setVideoOptions(@NonNull VideoOptions videoOptions)

Sets the VideoOptions for this request.

Protected methods

getAdSourceExtrasBundles

protected final @NonNull <Error class: unknown class> getAdSourceExtrasBundles()

getAdUnitId

protected final String getAdUnitId()

The ad unit ID.

getCategoryExclusions

protected final @NonNull <Error class: unknown class> getCategoryExclusions()

getContentUrl

protected final String getContentUrl()

getCustomTargeting

protected final @NonNull <Error class: unknown class> getCustomTargeting()

getGoogleExtrasBundle

protected final @NonNull Bundle getGoogleExtrasBundle()

getKeywords

protected final @NonNull <Error class: unknown class> getKeywords()

getNeighboringContentUrls

protected final @NonNull <Error class: unknown class> getNeighboringContentUrls()

getPlacementId

protected final long getPlacementId()

getPublisherProvidedId

protected final String getPublisherProvidedId()

getRequestAgent

protected final String getRequestAgent()

getSignalType

protected final @NonNull String getSignalType()

setAdUnitId

protected final void setAdUnitId(String adUnitId)

The ad unit ID.