Banner
Banner is a view subclass able to show banner ads. Once obtained via the provided initializer, the developer is responsible for adding it to the app's view hierarchy and laying it out properly.
The developer should not give the banner view object a frame size different from its BannerSize property.
The developer is responsible for removing the banner from the view when changing the view. After the banner is detached, it has to be recreated as a new object.
By default, a banner will automatically update its content on its own. This means you only need to call show() once and the banner will get new ads and show them, gracefully handling errors if they occur.
You can create and present as many banners as you want at the same time.
A typical implementation would look like this:
fun createAndShowBanner() {
val banner = Banner(this, "location", BannerSize.STANDARD, callback)
view_container?.removeAllViews()
view_container?.addView(banner, getViewParams())
banner.show()
}
For more information on integrating and using the Chartboost SDK, please visit our help site documentation at https://help.chartboost.com.
Constructors
Types
Properties
Functions
Caches an ad. This method will first check if there is a cached ad and, if found, will do nothing. If no cached ad exists, the method will attempt to fetch it from the Chartboost server. Implement didCacheAd(event: CacheEvent, error: CacheError?)
to be notified of the cache request result.
Caches an ad with bid response. This method will parse the provided bid response and cache the ad accordingly.
Clears the ad cache. This will do nothing if there's no cached ad. Otherwise, it will remove any data related to the ad, bringing the ad instance back to a non-cached state. After calling this method, you may call cache
again and a new ad will be fetched.