remember Banner Ad
A Composable function that remembers a BannerAdHandler across compositions.
This function creates and manages a BannerAdHandler instance, ensuring it persists across recompositions. It automatically attempts to load an ad when the ad's state is AdState.DISMISSED or AdState.NONE.
Note: This Composable depends on the Google Mobile Ads SDK. Ensure that the SDK is properly integrated into your project.
Return
A MutableState holding the BannerAdHandler. You can use this state to interact with the ad (e.g., to display it in your UI).
Parameters
The current Activity or Context. This is crucial for the ad to function correctly. It's recommended to pass the result of LocalContext.current as Activity
.
The ad unit ID for the banner ad. Defaults to AdUnitId.BANNER_DEFAULT.
The size of the banner ad. Defaults to AdSize.FULL_BANNER.
A callback invoked when the ad has successfully loaded.
A callback invoked when the ad fails to load. It provides an Exception with details about the failure.
A callback invoked when the ad is dismissed by the user.
A callback invoked when the ad is shown on the screen.
A callback invoked when an impression is recorded for the ad.
A callback invoked when the ad is clicked by the user.