NativeAdCompose
fun NativeAdCompose(adUnitId: String, size: NativeAdSize = NativeAdSize.SMALL, modifier: Modifier = Modifier, useCachedAd: Boolean = true, loadingStrategy: AdLoadingStrategy? = null, onAdLoaded: () -> Unit? = null, onAdFailedToLoad: (AdError?) -> Unit? = null, onAdClicked: () -> Unit? = null, onAdImpression: () -> Unit? = null, onAdOpened: () -> Unit? = null, onAdClosed: () -> Unit? = null, onPaidEvent: (AdValue) -> Unit? = null)
A Jetpack Compose wrapper for native ads from AdManageKit.
This composable provides an easy way to display native ads in Compose UIs while maintaining all the functionality of the original native ad views.
Since
2.1.0
Parameters
adUnitId
The AdMob ad unit ID
size
The size of the native ad (SMALL, MEDIUM, LARGE)
modifier
Modifier for styling the ad container
useCachedAd
Whether to use cached ads if available (deprecated, use loadingStrategy)
loadingStrategy
Optional loading strategy override (ON_DEMAND, ONLY_CACHE, HYBRID)
onAdLoaded
Callback when the ad loads successfully
onAdFailedToLoad
Callback when the ad fails to load
onAdClicked
Callback when the ad is clicked
onAdImpression
Callback when the ad impression is recorded
onAdOpened
Callback when the ad opens an overlay
onAdClosed
Callback when the ad overlay is closed
onPaidEvent
Callback when a paid event occurs (for revenue tracking)