rememberInterstitialAd
fun rememberInterstitialAd(adUnitId: String, preloadAd: Boolean = true, onAdShown: () -> Unit? = null, onAdDismissed: () -> Unit? = null, onAdFailedToLoad: (String) -> Unit? = null): () -> Unit
A Compose effect for managing interstitial ads using AdManager.
This composable provides a declarative way to handle interstitial ads in Compose UIs. It automatically handles lifecycle events and provides callbacks for ad events.
Return
A function to show the interstitial ad
Since
2.1.0
Parameters
adUnitId
The AdMob interstitial ad unit ID
preloadAd
Whether to preload the ad when the effect starts
onAdShown
Callback when the ad is shown successfully
onAdDismissed
Callback when the ad is dismissed or no ad available
onAdFailedToLoad
Callback when the ad fails to load