AdRequest

open class AdRequest

Known direct subclasses
BannerAdRequest

A banner ad request.

IconAdRequest

An AdRequest for IconAds.

NativeAdRequest

A native ad request.

SwipeableInterstitialAdRequest

An AdRequest for Swipeable Interstitial ads.


An AdRequest contains targeting information used to fetch an ad. Ad requests are created using AdRequest.Builder.

Summary

Nested types

Builder class for AdRequest.

@IntDef(value = [0, 1, 2, 3, 4, 5, 6])
@Retention(value = AnnotationRetention.SOURCE)
annotation AdRequest.ErrorCode

Protected constructors

AdRequest(
    adUnitId: String,
    categoryExclusions: Set<String>,
    contentUrl: String?,
    customTargeting: Map<StringString>,
    googleExtrasBundle: Bundle,
    keywords: Set<String>,
    neighboringContentUrls: Set<String>,
    adSourceExtrasBundles: Map<StringBundle>,
    publisherProvidedId: String?,
    requestAgent: String?,
    placementId: Long,
    skipUninitializedAdapters: Boolean
)

Public functions

Bundle?

Gets the extras bundle associated with an ad source's adapter, if present.

Public properties

open String

The ad unit ID.

Set<String>

The slot-level ad category exclusion labels.

String?

The content URL targeting information.

Map<StringString>

The custom targeting parameters.

Bundle

The extra parameters to pass to Google ad network

Set<String>

The targeting information keywords.

Set<String>

The list of neighboring content URLs or an empty List if no URLs were set.

Long

An identifier for a placement in reporting.

String?

A publisher-provided identifier used for frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

String?

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

Protected constructors

AdRequest

protected AdRequest(
    adUnitId: String,
    categoryExclusions: Set<String>,
    contentUrl: String?,
    customTargeting: Map<StringString>,
    googleExtrasBundle: Bundle,
    keywords: Set<String>,
    neighboringContentUrls: Set<String>,
    adSourceExtrasBundles: Map<StringBundle>,
    publisherProvidedId: String?,
    requestAgent: String?,
    placementId: Long,
    skipUninitializedAdapters: Boolean
)

Public functions

getAdSourceExtrasBundle

fun getAdSourceExtrasBundle(adapterClass: Class<MediationExtrasReceiver>): Bundle?

Gets the extras bundle associated with an ad source's adapter, if present.

Public properties

adUnitId

open val adUnitIdString

The ad unit ID.

categoryExclusions

val categoryExclusionsSet<String>

The slot-level ad category exclusion labels. Default to an empty Set if not set.

contentUrl

val contentUrlString?

The content URL targeting information. Default to null if not set.

customTargeting

val customTargetingMap<StringString>

The custom targeting parameters. Default to an empty Map if not set.

googleExtrasBundle

val googleExtrasBundleBundle

The extra parameters to pass to Google ad network

keywords

val keywordsSet<String>

The targeting information keywords.

neighboringContentUrls

val neighboringContentUrlsSet<String>

The list of neighboring content URLs or an empty List if no URLs were set.

placementId

val placementIdLong

An identifier for a placement in reporting. A value set here will be set onto any ad returned by this request.

publisherProvidedId

val publisherProvidedIdString?

A publisher-provided identifier used for frequency capping, audience segmentation and targeting, sequential ad rotation, and other audience-based ad delivery controls across devices.

requestAgent

val requestAgentString?

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