AdManager

interface AdManager(source)

Entry point to the ads SDK. Provides controllers for every ad format, consent lifecycle management, diagnostics, and a flow of AdEvents. Obtain the process-wide singleton via rememberAdManager (Compose) or AdMob.manager(context) (Android, outside Compose).

Factory functions (banner, interstitial, rewarded, etc.) return cached controllers per placement id. Reusing the same id with a different AdPlacement configuration throws an IllegalStateException.

Controllers are cached for the lifetime of the manager and are not evicted automatically. Use a small, finite set of static placement ids — do not generate per-item ids (e.g. "feed_item_$index"), which would accumulate controllers without bound. For repeating UI (feeds, lists), reuse one placement id across items; the native pool handles per-item ads.

Inheritors

Properties

Link copied to clipboard

Consent lifecycle controller (UMP integration).

Link copied to clipboard

Diagnostics and debug tools.

Link copied to clipboard
abstract val events: SharedFlow<AdEvent>

Shared flow of ad lifecycle events (AdEvent) for all formats.

Link copied to clipboard
abstract val status: StateFlow<AdManagerStatus>

Current initialization and consent state of the SDK.

Link copied to clipboard

App Tracking Transparency controller (iOS); a no-op reporting NotApplicable on Android.

Functions

Link copied to clipboard
abstract fun appOpen(placement: AdPlacement): AppOpenAdController

Returns an AppOpenAdController for placement, cached by id.

Link copied to clipboard
abstract fun banner(placement: AdPlacement): BannerAdController

Returns a BannerAdController for placement, cached by id.

Link copied to clipboard

Convenience extension that calls initialize with ConsentMode.GatherBeforeInitialize — the standard consent flow that requests a UMP update, shows the form if required, and initializes ads when permitted.

Link copied to clipboard
abstract suspend fun initialize(config: AdConfig, consentMode: ConsentMode = ConsentMode.GatherBeforeInitialize): AdManagerStatus

Initializes the Google Mobile Ads SDK with the given config and consentMode.

Link copied to clipboard

Returns an InterstitialAdController for placement, cached by id.

Link copied to clipboard
abstract fun nativeAd(placement: AdPlacement): NativeAdPool

Returns a NativeAdPool for placement, cached by id.

Link copied to clipboard
abstract fun rewarded(placement: AdPlacement): RewardedAdController

Returns a RewardedAdController for placement, cached by id.

Link copied to clipboard
Link copied to clipboard

Convenience extension that calls ConsentController.showPrivacyOptions on this manager's AdManager.consent controller.