Banner Ad Handler
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)Content copied to clipboard
See also
Properties
Link copied to clipboard
Holds the active AdSize of the BannerAdHandler
Holds the active AdSize of the BannerAdHandler
Holds the active AdSize of the BannerAdHandler
banner View
Link copied to clipboard
Link copied to clipboard
Determines the AdState of the BannerAdHandler
Determines the AdState of the BannerAdHandler
Determines the AdState of the BannerAdHandler
Functions
Link copied to clipboard
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.