BannerSignalRequest.Builder

class BannerSignalRequest.Builder


A builder class for creating BannerSignalRequest.

Summary

Public constructors

Builder(signalType: String)

Gets a Builder for BannerSignalRequest.

Public functions

BannerSignalRequest.Builder

Sets a slot-level ad category exclusion label.

BannerSignalRequest.Builder

Adds a keyword for targeting purposes.

BannerSignalRequest

Constructs a BannerSignalRequest with the specified attributes.

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

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

BannerSignalRequest.Builder

Adds a custom targeting parameter.

BannerSignalRequest.Builder

Adds a custom targeting parameter with multiple values.

BannerSignalRequest.Builder

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

BannerSignalRequest.Builder

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

BannerSignalRequest.Builder

Sets the ad unit ID.

BannerSignalRequest.Builder

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

BannerSignalRequest.Builder

Set extra parameters to pass to AdMob or Ad Manager.

open BannerSignalRequest.Builder

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

BannerSignalRequest.Builder

Sets URLs representing web content near an ad.

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.

BannerSignalRequest.Builder

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

open BannerSignalRequest.Builder

Sets the VideoOptions for this request.

Public constructors

Builder

Builder(signalType: String)

Gets a Builder for BannerSignalRequest.

Public functions

addCategoryExclusion

@CanIgnoreReturnValue
fun addCategoryExclusion(categoryExclusion: String): BannerSignalRequest.Builder

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
fun addKeyword(keyword: String): BannerSignalRequest.Builder

Adds a keyword for targeting purposes.

build

fun build(): BannerSignalRequest

Constructs a BannerSignalRequest with the specified attributes.

putAdSourceExtrasBundle

@CanIgnoreReturnValue
fun putAdSourceExtrasBundle(
    adapterClass: Class<MediationExtrasReceiver>,
    adSourceExtras: Bundle
): BannerSignalRequest.Builder

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

Parameters
adapterClass: Class<MediationExtrasReceiver>

The Class of the adapter that should receive extras.

adSourceExtras: Bundle

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

putCustomTargeting

@CanIgnoreReturnValue
fun putCustomTargeting(key: String, value: String): BannerSignalRequest.Builder

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
fun putCustomTargeting(key: String, values: List<String>): BannerSignalRequest.Builder

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
fun setAdSize(adSize: AdSize): BannerSignalRequest.Builder

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

setAdSizes

@CanIgnoreReturnValue
fun setAdSizes(adSizes: List<AdSize>): BannerSignalRequest.Builder

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
fun setAdUnitId(adUnitId: String): BannerSignalRequest.Builder

Sets the ad unit ID.

setContentUrl

@CanIgnoreReturnValue
fun setContentUrl(contentUrl: String): BannerSignalRequest.Builder

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
kotlin.IllegalArgumentException

If contentUrl is empty.

setGoogleExtrasBundle

@CanIgnoreReturnValue
fun setGoogleExtrasBundle(extraBundle: Bundle): BannerSignalRequest.Builder

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

Parameters
extraBundle: Bundle

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

setManualImpressionEnabled

@CanIgnoreReturnValue
open fun setManualImpressionEnabled(enabled: Boolean): BannerSignalRequest.Builder

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

setNeighboringContentUrls

@CanIgnoreReturnValue
fun setNeighboringContentUrls(neighboringContentUrls: Set<String>): BannerSignalRequest.Builder

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
neighboringContentUrls: Set<String>

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

setPublisherProvidedId

@CanIgnoreReturnValue
fun setPublisherProvidedId(publisherProvidedId: String): 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.

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

setRequestAgent

@CanIgnoreReturnValue
fun setRequestAgent(requestAgent: String): BannerSignalRequest.Builder

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
open fun setVideoOptions(videoOptions: VideoOptions): BannerSignalRequest.Builder

Sets the VideoOptions for this request.

Protected functions

getContentUrl

protected fun getContentUrl(): String?

getGoogleExtrasBundle

protected fun getGoogleExtrasBundle(): Bundle

getPlacementId

protected fun getPlacementId(): Long

getPublisherProvidedId

protected fun getPublisherProvidedId(): String?

getRequestAgent

protected fun getRequestAgent(): String?

self

protected open fun self(): BannerSignalRequest.Builder

Protected properties

adSourceExtrasBundles

protected val adSourceExtrasBundlesMutableMap<StringBundle>

adUnitId

protected var adUnitIdString?

The ad unit ID.

categoryExclusions

protected val categoryExclusionsMutableSet<String>

customTargeting

protected val customTargetingMutableMap<StringString>

keywords

protected val keywordsHashSet<String>

neighboringContentUrls

protected val neighboringContentUrlsHashSet<String>

signalType

protected val signalTypeString