BannerAdHandler

actual class BannerAdHandler(activity: Any?)
expect class BannerAdHandler(activity: Any?)

A BannerAdHandler creates landscape ads that cover part of the host app screen.

Parameters

activity

Android required Activity

// Instantiate
val ad = BannerAdHandler(activity)
// Load the Ad
ad.load(
adUnitId = "AD_UNIT_ID_GOES_HERE", // Banner Ad Unit ID from AdMob
adSize = AdSize.FULL_BANNER // Banner AdSize goes here
onFailure = {}, // Callback when ad fails to display
onDismissed = {}, // Callback when ad is dismissed
onShown = {}, // Callback after ad is shown
onImpression = {}, // Callback after the ad makes an impression
onClick = {} // Callback on ad click
)
// Show the ad in your Composable
BannerAd(ad)

See also

actual class BannerAdHandler(activity: Any?)

Constructors

Link copied to clipboard
actual constructor(activity: Any?)
expect constructor(activity: Any?)
actual constructor(activity: Any?)

Properties

Link copied to clipboard
actual val adSize: AdSize

Holds the active AdSize of the BannerAdHandler

expect val adSize: AdSize

Holds the active AdSize of the BannerAdHandler

actual val adSize: AdSize

Holds the active AdSize of the BannerAdHandler

bannerView
Link copied to clipboard
Link copied to clipboard
actual val state: AdState

Determines the AdState of the BannerAdHandler

expect val state: AdState

Determines the AdState of the BannerAdHandler

actual val state: AdState

Determines the AdState of the BannerAdHandler

Functions

Link copied to clipboard
@RequiresPermission(value = "android.permission.INTERNET")
actual fun load(adUnitId: String, adSize: AdSize, onLoad: () -> Unit, onFailure: (Exception) -> Unit, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit)
expect fun load(adUnitId: String = AdUnitId.BANNER_DEFAULT, adSize: AdSize = AdSize.FULL_BANNER, onLoad: () -> Unit = {}, onFailure: (Exception) -> Unit = {}, onDismissed: () -> Unit = {}, onShown: () -> Unit = {}, onImpression: () -> Unit = {}, onClick: () -> Unit = {})

Loads an Banner Ad. Note: Make all calls to the Mobile Ads SDK on the main thread.

actual fun load(adUnitId: String, adSize: AdSize, onLoad: () -> Unit, onFailure: (Exception) -> Unit, onDismissed: () -> Unit, onShown: () -> Unit, onImpression: () -> Unit, onClick: () -> Unit)