AdPlacement

data class AdPlacement(val id: String, val format: AdFormat, val adUnitIds: AdUnitIds, val requestOptions: AdRequestOptions = AdRequestOptions(), val cachePolicy: AdCachePolicy = AdCachePolicy(), val retryPolicy: AdRetryPolicy = AdRetryPolicy(), val timeoutPolicy: AdTimeoutPolicy = AdTimeoutPolicy(), val bannerSizePolicy: AdSizePolicy = AdSizePolicy.LargeAnchoredAdaptive(), val bannerRefreshPolicy: BannerRefreshPolicy = BannerRefreshPolicy.AdServerManaged, val nativeOptions: NativeAdOptions = NativeAdOptions(), val fullScreenOptions: FullScreenAdOptions = FullScreenAdOptions(), val enabled: Boolean = true, val strictTestMode: Boolean = false)(source)

Defines a single ad placement — the complete configuration needed to request and render ads of a given format. Every controller factory on AdManager takes an AdPlacement and caches the resulting controller by id.

Parameters

id

Unique identifier for this placement. Used for controller caching and event attribution.

format

The ad format this placement targets.

adUnitIds

Per-platform ad-unit IDs.

requestOptions

Per-request targeting and extras.

cachePolicy

Cache sizing, TTL, and reload behavior.

retryPolicy

Retry strategy for failed loads.

timeoutPolicy

Bounds on how long a load or presentation hand-off may take before it is treated as failed.

bannerSizePolicy

Banner size (only relevant for AdFormat.Banner).

bannerRefreshPolicy

Banner auto-refresh policy (only relevant for AdFormat.Banner).

nativeOptions

Native ad rendering options (only relevant for AdFormat.Native).

fullScreenOptions

Full-screen ad display options (only relevant for full-screen formats).

enabled

When false, the placement is skipped by composables and lookups via List.placement.

strictTestMode

When true, the placement throws at construction if any ad unit id is not a Google test ad unit. Opt-in and default false; intended for debug builds only. Does not affect production builds.

Throws

if id is blank, cachePolicy.maxSize< 1, or strictTestMode is enabled and any ad unit id is not a test unit.

Constructors

Link copied to clipboard
constructor(id: String, format: AdFormat, adUnitIds: AdUnitIds, requestOptions: AdRequestOptions = AdRequestOptions(), cachePolicy: AdCachePolicy = AdCachePolicy(), retryPolicy: AdRetryPolicy = AdRetryPolicy(), timeoutPolicy: AdTimeoutPolicy = AdTimeoutPolicy(), bannerSizePolicy: AdSizePolicy = AdSizePolicy.LargeAnchoredAdaptive(), bannerRefreshPolicy: BannerRefreshPolicy = BannerRefreshPolicy.AdServerManaged, nativeOptions: NativeAdOptions = NativeAdOptions(), fullScreenOptions: FullScreenAdOptions = FullScreenAdOptions(), enabled: Boolean = true, strictTestMode: Boolean = false)
constructor(id: String, format: AdFormat, androidAdUnitId: String, iosAdUnitId: String, maxCacheSize: Int = 1, enabled: Boolean = true, strictTestMode: Boolean = false)

Convenience constructor that accepts platform ad-unit IDs directly instead of an AdUnitIds wrapper.

Properties

Link copied to clipboard
Link copied to clipboard

Convenience accessor for the Android ad-unit ID.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val id: String
Link copied to clipboard

Convenience accessor for the iOS ad-unit ID.

Link copied to clipboard

Convenience accessor for AdCachePolicy.maxSize.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard