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)
AdropPopupAd popupAd = new AdropPopupAd(context, "YOUR_UNIT_ID");
popupAd.setPopupAdListener(new AdropPopupAdListener() {
@Override
public void onAdReceived(@NotNull AdropPopupAd ad) {
Log.d("Adrop", "popup ad received");
}
@Override
public void onAdFailedToReceive(@NotNull AdropPopupAd ad, @NotNull AdropErrorCode errorCode) {
Log.d("Adrop", "popup ad failed to receive error: " + errorCode);
}
@Override
public void onAdFailedToShowFullScreen(@NotNull AdropPopupAd ad, @NotNull AdropErrorCode errorCode) {
Log.d("Adrop", "popup ad failed to show full screen, error: " + errorCode);
}
...
}
popupAd.setBackgroundColor(your_color_int); // optional
popupAd.setCloseTextColor(your_color_int); // optional
popupAd.setHideForTodayTextColor(your_color_int); // optional
popupAd.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()
popupAd.destroy();
Last updated