SwipeableInterstitialAdRequest.Builder

@ExperimentalApi
class SwipeableInterstitialAdRequest.Builder : SwipeableInterstitialRequest.Builder


A builder for a swipeable interstitial ad request.

Summary

Public constructors

Builder(adUnitId: String)

Public functions

SwipeableInterstitialAdRequest.Builder

Sets a slot-level ad category exclusion label.

SwipeableInterstitialAdRequest.Builder

Adds a keyword for targeting purposes.

SwipeableInterstitialAdRequest

Constructs an SwipeableInterstitialAdRequest with the specified attributes.

open SwipeableInterstitialAdRequest.Builder
@CanIgnoreReturnValue
enableCustomClickSwipeGesture(
    customClickSwipeGestureDirection: NativeAd.SwipeGestureDirection,
    customClickSwipeGestureTapsAllowed: Boolean
)

Enables swipes as a custom click gesture.

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

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

SwipeableInterstitialAdRequest.Builder

Adds a custom targeting parameter.

SwipeableInterstitialAdRequest.Builder

Adds a custom targeting parameter with multiple values.

open SwipeableInterstitialAdRequest.Builder

Sets the size of the ad.

SwipeableInterstitialAdRequest.Builder

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

SwipeableInterstitialAdRequest.Builder

Set extra parameters to pass to AdMob or Ad Manager.

open SwipeableInterstitialAdRequest.Builder

Specifies the maximum duration (in seconds) the app commits to holding the ad on screen before it is eligible for dismissal.

SwipeableInterstitialAdRequest.Builder

Sets URLs representing web content near an ad.

open SwipeableInterstitialAdRequest.Builder

Sets a default placement ID for the loaded ad.

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

SwipeableInterstitialAdRequest.Builder

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

SwipeableInterstitialAdRequest.Builder

Instructs the SDK to not collect bidding signals or execute waterfall elements for adapters that have not yet successfully initialized.

Public constructors

Builder

Builder(adUnitId: String)

Public functions

addCategoryExclusion

@CanIgnoreReturnValue
fun addCategoryExclusion(categoryExclusion: String): SwipeableInterstitialAdRequest.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): SwipeableInterstitialAdRequest.Builder

Adds a keyword for targeting purposes.

build

fun build(): SwipeableInterstitialAdRequest

Constructs an SwipeableInterstitialAdRequest with the specified attributes.

enableCustomClickSwipeGesture

@CanIgnoreReturnValue
open fun enableCustomClickSwipeGesture(
    customClickSwipeGestureDirection: NativeAd.SwipeGestureDirection,
    customClickSwipeGestureTapsAllowed: Boolean
): SwipeableInterstitialAdRequest.Builder

Enables swipes as a custom click gesture.

Available for allowlisted publishers only. These settings will be ignored for publishers not allowlisted.

Parameters
customClickSwipeGestureDirection: NativeAd.SwipeGestureDirection

The SwipeGestureDirection to be counted as a click.

customClickSwipeGestureTapsAllowed: Boolean

Whether taps should still be allowed as clicks. Default is true.

putAdSourceExtrasBundle

@CanIgnoreReturnValue
fun putAdSourceExtrasBundle(
    adapterClass: Class<MediationExtrasReceiver>,
    adSourceExtras: Bundle
): SwipeableInterstitialAdRequest.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): SwipeableInterstitialAdRequest.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>): SwipeableInterstitialAdRequest.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
open fun setAdSize(width: Int, height: Int): SwipeableInterstitialAdRequest.Builder

Sets the size of the ad.

If this method is not called, the ad defaults to full-screen size dimensions.

Note: The ad size must be at least 60% of the screen size. Sizes smaller than this threshold will result in a load failure.

Parameters
width: Int

The width of the requested ad in dp.

height: Int

The height of the requested ad in dp.

setContentUrl

@CanIgnoreReturnValue
fun setContentUrl(contentUrl: String): SwipeableInterstitialAdRequest.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): SwipeableInterstitialAdRequest.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.

setMaxScreenHoldDurationSeconds

@CanIgnoreReturnValue
open fun setMaxScreenHoldDurationSeconds(maxScreenHoldDurationSeconds: Int): SwipeableInterstitialAdRequest.Builder

Specifies the maximum duration (in seconds) the app commits to holding the ad on screen before it is eligible for dismissal. The SDK only returns ads with a hold requirement that is less than or equal to this value. Defaults to 0.

Only set this property if your app implements logic to hold swipeable interstitial ads on screen.

Parameters
maxScreenHoldDurationSeconds: Int

The maximum screen hold duration in seconds. Must be positive.

setNeighboringContentUrls

@CanIgnoreReturnValue
fun setNeighboringContentUrls(neighboringContentUrls: Set<String>): SwipeableInterstitialAdRequest.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.

setPlacementId

@CanIgnoreReturnValue
open fun setPlacementId(placementId: Long): SwipeableInterstitialAdRequest.Builder

Sets a default placement ID for the loaded ad.

Parameters
placementId: Long

A long integer provided by the AdMob UI for the configured placement.

setPublisherProvidedId

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

skipUninitializedAdapters

@ExperimentalApi
fun skipUninitializedAdapters(): SwipeableInterstitialAdRequest.Builder

Instructs the SDK to not collect bidding signals or execute waterfall elements for adapters that have not yet successfully initialized.

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?

getSkipUninitializedAdapters

protected fun getSkipUninitializedAdapters(): Boolean

self

protected open fun self(): SwipeableInterstitialAdRequest.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>