Skip to content

Android SDK - Ad optimization

Best loaded ad

bestLoadedAd returns the ad the next show() would display, or null if there is none. Set bestLoadedAdListener to be notified when it changes:

val interstitial = A11.getInterstitialAd("adUnitID")

interstitial.bestLoadedAdListener = BestLoadedAdListener { adInfo ->
    // adInfo is null when no ad is ready
}

val current: AdInfo? = interstitial.bestLoadedAd

External loss reporting

If an impression for an ad unit goes to an ad source outside the MDN11 SDK, call notifyLossToExternal, so the MDN11 SDK can factor it into its decisions.

val interstitial = A11.getInterstitialAd("adUnitID")

interstitial.notifyLossToExternal(price = 2.50) // eCPM the external source served at

// Or when the price isn't known:
interstitial.notifyLossToExternal()

Caution

price must be the eCPM (effective cost per mille) the external source served at.

Info

Reports made before the ad unit's first load() are kept (up to 8, oldest dropped) and applied when it loads.