NativeTemplateCompose

fun NativeTemplateCompose(adUnitId: String, template: NativeAdTemplate = NativeAdTemplate.CARD_MODERN, modifier: Modifier = Modifier, 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 NativeTemplateView.

Supports all 17 template styles with Material 3 theming.

Since

2.6.0

Parameters

adUnitId

The AdMob ad unit ID

template

The template style to use (default: CARD_MODERN)

modifier

Modifier for styling the ad container

loadingStrategy

Loading strategy (ON_DEMAND or HYBRID). Note: ONLY_CACHE is not supported for native ads.

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)