Display popup ad on Android

Display a popup ad

val popupAd = AdropPopupAd(context, "YOUR_UNIT_ID")
popupAd.run {
    closeTextColor = your_color_int         // optional
    hideForTodayTextColor = your_color_int  // optional
    backgroundColor = your_color_int        // optional

    popupAdListener = object:AdropPopupAdListener {
        override fun onAdReceived(ad: AdropPopupAd) {
            Log.d("Adrop", "popup ad received")
        }

        override fun onAdFailedToReceive(ad: AdropPopupAd, errorCode: AdropErrorCode) {
            Log.d("Adrop", "popup ad failed to receive $errorCode")
        }
    }
    load()
}

...
// call show function when the ad needs to be displayed.
popupAd.show(activity)

Destroy

When you are done showing your AdropPopupAd, you should destroy it so that the ad is properly garbage collected.

popupAd.destroy()

Last updated