BannerAd

@RequiresPermission(value = "android.permission.INTERNET")
@Composable
actual fun BannerAd(adUnitId: String, adSize: AdSize, onLoad: () -> Unit)

Loads and displays a banner ad.

This composable is a simple way to display a banner ad without manual lifecycle management. It creates and loads an AdView and displays it.

Parameters

adUnitId

The ad unit ID for the banner ad.

adSize

The size of the banner ad.

onLoad

A callback invoked when the ad has finished loading.


@RequiresPermission(value = "android.permission.INTERNET")
@Composable
actual fun BannerAd(ad: BannerAdHandler)

Displays a pre-loaded banner ad from a BannerAdHandler.

This composable takes a BannerAdHandler (which should be remembered using rememberBannerAd) and manages its lifecycle, pausing, resuming, and destroying the ad in sync with the composable's lifecycle.

Parameters

ad

The BannerAdHandler containing the pre-loaded banner ad.

@Composable
expect fun BannerAd(adUnitId: String = AdUnitId.BANNER_DEFAULT, adSize: AdSize = AdSize.FULL_BANNER, onLoad: () -> Unit = {})

Loads and displays a Banner Ad using a Composable.

Parameters

adUnitId

Your AdMob AdUnitId String

adSize

Your AdMob AdSize

onLoad

Lambda expression that executes after the Google AdRequest has fully loaded

See also


@Composable
expect fun BannerAd(ad: BannerAdHandler)

Loads and displays a Banner Ad using a Composable.

Parameters

ad

The BannerAdHandler built within your Composable using rememberBannerAd

See also

@Composable
actual fun BannerAd(adUnitId: String, adSize: AdSize, onLoad: () -> Unit)
@Composable
actual fun BannerAd(ad: BannerAdHandler)