NativeTemplateCompose
A Jetpack Compose wrapper for NativeTemplateView.
Supports all 17 template styles with Material 3 theming.
Since
2.6.0
Parameters
The AdMob ad unit ID
The template style to use (default: CARD_MODERN)
Modifier for styling the ad container
Loading strategy. All four strategies are supported for native ads; ONLY_CACHE serves a cached ad if one is ready and otherwise hides the container without issuing a network request.
Callback when the ad loads successfully
Callback when the ad fails to load
Callback when the ad is clicked
Callback when the ad impression is recorded
Callback when the ad opens an overlay
Callback when the ad overlay is closed
Callback when a paid event occurs (for revenue tracking)
Optional fully custom native ad layout, overrides template when set. Root must be (or inflate as) a NativeAdView reusing the standard asset ids (ad_headline, ad_body, ad_call_to_action, ad_app_icon, ad_advertiser, ad_media, ad_stars, ad_choices_view). See NativeTemplateView.setCustomTemplate.
Optional loading placeholder for customLayoutResId. Falls back to template's shimmer if omitted.
Cache classification / Yandex waterfall fallback size for customLayoutResId, since a custom layout has no built-in size bucket.