Banner
Integrate banner ads
Banner ads are displayed in RTBBannerView instances, so the first step towards integrating banner ads is to create an instance of RTBBannerView and add it to your view hierarchy.
Create an RTBBannerView Instance
Create an instance of RTBBannerView:
val bannerAdView = RTBBannerView(this)
bannerAdView.bannerSize = RTBBannerSize.banner320x50The banner size will be used later while loading a new banner ad.
Listen to Callbacks
Through the use of RTBBannerViewDelegate, you can listen to the different callbacks.
bannerAdView.delegate = thisRequest Ad
To load a banner ad, you will need to pass an instance of RTBBannerRequestConfiguration with placementID and the bundleId. Please contact our support for getting the needed IDs.
val rtbBannerRequestConfiguration = RTBBannerRequestConfiguration(placementId, bundleId)
rtbBannerRequestConfiguration.sellerId = "<SELLERID>" // Optional
rtbBannerRequestConfiguration.bidFloor = <BID_FLOOR> // Optional
bannerAdView.load(rtbBannerRequestConfiguration)You will be notified about the loading success/failure through the RTBBannerViewDelegate
Optional - set user targeting
You can pass user targeting data to each request, allowing ads to be more relevant to your audience. Each field in RTBUserTargeting is optional.
Complete Code Example
Last updated