Light Popup Ad Format
Full-screen ad format that automatically closes after 8 seconds. Less disruptive to UX than interstitial or rewarded video ads.
Integrating Ads
Create adUnit
val adUnit = DaroLightPopupAdUnit(
key = ${AdUnitId},
placement = ${placement}, //Name displayed in logs. Can be left empty.
options = DaroLightPopupAdOptions()
)
Show DaroLightPopupAdOptions
Show DaroLightPopupAdOptions
Overall background color
Popup container background color
Top ad mark text color
Top ad mark background color
Title text color
Body text color
CTA (button) background color
CTA (button) text color
Close button text
Close button text color
Create Loader and load ad
val loader = DaroLightPopupAdLoader(
context = context,
adUnit = adUnit
)
loader.setListener(object : DaroLightPopupAdLoaderListener {
override fun onAdLoadSuccess(ad: DaroLightPopupAd, adInfo: DaroAdInfo) {
// ...
}
override fun onAdLoadFail(err: DaroAdLoadError) {
// ...
}
})
loader.load()
Set listener and show ad
loader.setListener(object : DaroLightPopupAdLoaderListener {
override fun onAdLoadSuccess(ad: DaroLightPopupAd, adInfo: DaroAdInfo) {
ad.setListener(object : DaroLightPopupAdListener {
override fun onAdImpression(adInfo: DaroAdInfo) {}
override fun onAdClicked(adInfo: DaroAdInfo) {}
override fun onShown(adInfo: DaroAdInfo) {}
override fun onFailedToShow(adInfo: DaroAdInfo, error: DaroAdDisplayFailError) {}
override fun onDismiss(adInfo: DaroAdInfo) {}
})
ad.show(activity = this@MainActivity)
}
override fun onAdLoadFail(err: DaroAdLoadError) {}
})
Example
private fun showLightPopupAd() {
DaroLightPopupAdLoader(
context = context,
adUnit = DaroLightPopupAdUnit(
key = ${AdUnitId},
placement = ${placement}
)
).apply {
setListener(object : DaroLightPopupAdLoaderListener {
override fun onAdLoadSuccess(
ad: DaroLightPopupAd,
adInfo: DaroAdInfo,
) {
Log.d("Ad Test", "lightpopup - success")
ad.setListener(object : DaroLightPopupAdListener {
override fun onAdImpression(adInfo: DaroAdInfo) {
Log.d("Ad Test", "lightpopup - impression")
}
override fun onAdClicked(adInfo: DaroAdInfo) {
Log.d("Ad Test", "lightpopup - clicked")
}
override fun onShown(adInfo: DaroAdInfo) {
Log.d("Ad Test", "lightpopup - onShown")
}
override fun onFailedToShow(
adInfo: DaroAdInfo,
error: DaroAdDisplayFailError,
) {
Log.d("Ad Test", "lightpopup - onFailedToShow")
}
override fun onDismiss(adInfo: DaroAdInfo) {
Log.d("Ad Test", "lightpopup - onDismiss")
ad.destory()
}
})
ad.show(activity = this@MainActivity)
}
override fun onAdLoadFail(err: DaroAdLoadError) {
Log.d("Ad Test", "lightpopup - fail : ${err.message}")
}
}
)
load()
}
}

