AdPlacement

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)(source)

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.


constructor(id: String, format: AdFormat, androidAdUnitId: String, iosAdUnitId: String, maxCacheSize: Int = 1, enabled: Boolean = true, strictTestMode: Boolean = false)(source)

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

Parameters

id

Unique identifier for this placement.

format

The ad format.

androidAdUnitId

Android ad-unit ID.

iosAdUnitId

iOS ad-unit ID.

maxCacheSize

Maximum number of cached ads (default 1). Must be >= 1.

enabled

When false, the placement is skipped.

strictTestMode

When true, the placement throws at construction if any ad unit id is not a Google test ad unit.

Throws

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