NativeAd

actual fun NativeAd(activity: Any?, nativeAdTemplate: NativeAdTemplate, adUnitId: String, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit, onFailure: (Exception) -> Unit, onLoad: () -> Unit)

A composable that loads and displays a native ad.

This function handles the entire lifecycle of a native ad, from loading it using rememberNativeAd to displaying it once it's in the AdState.READY state.

Parameters

activity

The current Activity, required for the Android implementation.

nativeAdTemplate

The composable template used to render the native ad UI.

adUnitId

The ad unit ID for the native ad.

onDismissed

A callback invoked when the ad is dismissed.

onShown

A callback invoked when the ad is shown.

onImpression

A callback invoked when an impression is recorded for the ad.

onClick

A callback invoked when the ad is clicked.

onFailure

A callback invoked when the ad fails to load.

onLoad

A callback invoked when the ad has successfully loaded.


actual fun NativeAd(loadedAd: NativeAdHandler, nativeAdTemplate: NativeAdTemplate)

A composable that displays a pre-loaded native ad from a NativeAdHandler.

This function should be used when you have already loaded a native ad and want to display it. It renders the ad data using the provided nativeAdTemplate.

Parameters

loadedAd

The NativeAdHandler containing the pre-loaded native ad.

nativeAdTemplate

The composable template used to render the native ad UI.

expect fun NativeAd(loadedAd: NativeAdHandler, nativeAdTemplate: NativeAdTemplate = NativeAdDefault())

A composable that displays a native ad.

Parameters

loadedAd

the pre-loaded native ad

nativeAdTemplate

the composable that will be used to display the native ad


expect fun NativeAd(activity: Any?, nativeAdTemplate: NativeAdTemplate = NativeAdDefault(), adUnitId: String = AdUnitId.NATIVE_DEFAULT, onDismissed: () -> Unit = {}, onShown: () -> Unit = {}, onImpression: () -> Unit = {}, onClick: () -> Unit = {}, onFailure: (Exception) -> Unit = {}, onLoad: () -> Unit = {})

A composable that displays a native ad.

Parameters

activity

the current Activity (only needed for Android Impl)

nativeAdTemplate

the composable that will be used to display the native ad

adUnitId

the ad unit ID for the native ad

onDismissed

a callback that will be invoked when the ad is dismissed

onShown

a callback that will be invoked when the ad is shown

onImpression

a callback that will be invoked when an impression is recorded for the ad

onClick

a callback that will be invoked when the ad is clicked

onFailure

a callback that will be invoked when the ad fails to load

onLoad

a callback that will be invoked when the ad has loaded

actual fun NativeAd(loadedAd: NativeAdHandler, nativeAdTemplate: NativeAdTemplate)

A composable that displays a native ad.

Parameters

loadedAd

the pre-loaded native ad

nativeAdTemplate

the composable that will be used to display the native ad


actual fun NativeAd(activity: Any?, nativeAdTemplate: NativeAdTemplate, adUnitId: String, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit, onFailure: (Exception) -> Unit, onLoad: () -> Unit)

A composable that displays a native ad.

Parameters

activity

the current Activity (only needed for Android Impl)

nativeAdTemplate

the composable that will be used to display the native ad

adUnitId

the ad unit ID for the native ad

onDismissed

a callback that will be invoked when the ad is dismissed

onShown

a callback that will be invoked when the ad is shown

onImpression

a callback that will be invoked when an impression is recorded for the ad

onClick

a callback that will be invoked when the ad is clicked

onFailure

a callback that will be invoked when the ad fails to load

onLoad

a callback that will be invoked when the ad has loaded