Banner
Integration
Layout XML
<com.wortise.ads.banner.BannerAd
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:adSize="HEIGHT_50"
app:adUnitId="Wortise Ad Unit ID" />Code
class MainActivity : Activity() {
private var bannerAd: BannerAd? = null
override fun onCreate(savedInstanceState: Bundle?) {
...
bannerAd = BannerAd(this).also {
it.adSize = AdSize.HEIGHT_50
it.adUnitId = "<Ad Unit ID de Wortise>"
// For example, we add the BannerAd into a FrameLayout
val frameLayout = findViewById<FrameLayout>(R.id.frame)
frameLayout.addView(it)
it.loadAd()
}
}
override fun onDestroy() {
...
bannerAd?.destroy()
}
override fun onPause() {
...
bannerAd?.pause()
}
override fun onResume() {
...
bannerAd?.resume()
}
}Adaptive banners
Anchored
Inline
Listener setup
Última actualización