Skip to content

Android SDK - API reference

Classes, members and errors of the MDN11 Android SDK.

A11

The SDK entry point: initialization, ad unit access, test mode, logging and debug tools.

Method / property Description
init(application, appKey, hostUrls) Initialize the SDK. Call once in Application.onCreate(). hostUrls is a list of host URLs used by the SDK to retrieve configuration.
init(application, appKey, staticConfig) Initialize with a publisher-provided JSON config string, skipping the remote fetch. Use when no backend endpoint is available or for offline environments.
init(application, appKey, staticConfig, hostUrls) Hybrid initialization: the SDK becomes usable immediately from staticConfig, while a remote config is fetched from hostUrls in the background and applied when it arrives.
getBannerAd(adUnitId): BannerAd Returns a cached banner ad instance.
getInterstitialAd(adUnitId): InterstitialAd Returns a cached interstitial ad instance.
getRewardedAd(adUnitId): RewardedAd Returns a cached rewarded ad instance.
getMrecAd(adUnitId): MrecAd Returns a cached MREC ad instance.
setTestAds(enabled) Enable SDK test mode with test credentials. Must set before init().
addLogger(logger: Logger) Register a logger to receive SDK log messages.
removeLogger(logger: Logger) Unregister a previously added logger.
launchDebugMenu(activity) Launch the debug tools UI. Requires the a11-sdk-debug module.
privacy: Privacy Privacy signals surface.
publisherProvidedSignals: PublisherProvidedSignals Publisher signals surface.

Privacy

Accessed through A11.privacy.

Method Description
setUserConsent(UserConsent) GDPR / LGPD consent per vendor. Can be updated during session.
setDoNotSell(Boolean) US privacy (e.g CCPA) signal. Can be updated during session.
setChildDirected(Boolean) Child directed flag (e.g. COPPA regulation). Must set before init(), cannot change after.

For a full list of which networks require direct publisher action on privacy, see the Network privacy reference.

PublisherProvidedSignals

Accessed through A11.publisherProvidedSignals.

Method Description
setPaidUser(Boolean?) Whether the user has made a purchase.
setUserId(String?) Publisher-defined user ID.
setInstalledApps(List<String>?) Package names of other publisher apps on the device.

Ad formats

BannerAd

Returned by A11.getBannerAd(adUnitId).

Member Description
adView: View Stable view to add to your layout. Add before calling load().
adSize: BannerAdSize Size specification. Set before load(). Default: Standard.
listener: BannerAdListener? Callback interface.
bestLoadedAdListener: BestLoadedAdListener? Notified when the best cached ad for this ad unit changes. See Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best cached ad, or null if none.
customParameters: Map<String, Any>? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load().
load(activity) Start loading.
show(activity) Start rendering and impression tracking.
notifyLossToExternal(price: Double? = null) Report that an impression for this ad unit went to an ad source outside the SDK. See External loss reporting.

InterstitialAd

Returned by A11.getInterstitialAd(adUnitId).

Member Description
listener: InterstitialAdListener? Callback interface.
bestLoadedAdListener: BestLoadedAdListener? Notified when the best cached ad for this ad unit changes. See Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best cached ad, or null if none.
customParameters: Map<String, Any>? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load().
load(activity) Load an ad.
show(activity) Present the interstitial.
notifyLossToExternal(price: Double? = null) Report that an impression for this ad unit went to an ad source outside the SDK. See External loss reporting.

RewardedAd

Returned by A11.getRewardedAd(adUnitId).

Member Description
listener: RewardedAdListener? Callback interface.
bestLoadedAdListener: BestLoadedAdListener? Notified when the best cached ad for this ad unit changes. See Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best cached ad, or null if none.
customParameters: Map<String, Any>? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load().
load(activity) Load an ad.
show(activity) Present the rewarded ad.
notifyLossToExternal(price: Double? = null) Report that an impression for this ad unit went to an ad source outside the SDK. See External loss reporting.

MrecAd

Returned by A11.getMrecAd(adUnitId).

Member Description
view: View Stable view to add to your layout. Add before calling load().
listener: MrecAdListener? Callback interface.
bestLoadedAdListener: BestLoadedAdListener? Notified when the best cached ad for this ad unit changes. See Best loaded ad.
bestLoadedAd: AdInfo? Snapshot of the best cached ad, or null if none.
customParameters: Map<String, Any>? Optional network-specific key-value pairs forwarded to supporting adapters. Set before load().
load(activity) Start loading.
show(activity) Start rendering and impression tracking.
notifyLossToExternal(price: Double? = null) Report that an impression for this ad unit went to an ad source outside the SDK. See External loss reporting.

Ad data

AdInfo

Passed to every listener callback. Contains impression-level data when available.

Field Type Description
adUnitId String MDN11 ad unit.
adCallId String Unique ID for this ad call.
sdkAdapter String Name of the SDK adapter that served the ad.
sdkPlacementId String? sdkAdapter's own placement id (e.g. an AdMob ad unit id, an AppLovin zone id) - null when the adapter exposes none.
adNetworkName String? Ad network that served the ad.
adImpressionValue AdImpressionValue? Impression valuation data, if available.
extraParameters Map<String, Any>? Adapter-specific load-response data, keyed by network (e.g. "google_admob" / "google_ad_manager" with fields from AdMob/GAM's ResponseInfo, including the mediation group id, or "unity_ads" with fields from LevelPlay's LevelPlayAdInfo) - null when the adapter provides none.

AdImpressionValue

Field Type Description
valuationMethod ValuationMethod ESTIMATED, PROVIDED, PRECISE, or UNKNOWN.
value BigDecimal Monetary value of the impression.
currency String? Currency code for value.

BestLoadedAdListener

Fun interface. See Best loaded ad for full semantics.

Member Description
onBestLoadedAdChanged(adInfo: AdInfo?) Called when the best cached ad for the ad unit changes. null when none is currently held.

Errors

Load errors

Error Meaning
WRONG_APP_KEY App key not recognized by the backend.
MISSING_CONFIG No waterfall configuration returned.
CONFIG_PARSE_FAILED Configuration could not be read: the JSON from your host URLs or your static configuration is invalid.
INVALID_CONFIG Configuration for the ad unit is invalid.
INVALID_HOST_URL No valid host URL: every host URL passed to init() was rejected, for example because it isn't HTTPS.
INVALID_AD_UNIT Ad unit ID not found in configuration.
NO_FILL No network returned an ad. Retry with backoff.
NETWORK Network or server error.
NO_NETWORK Device has no internet connection.
TIMEOUT Ad request timed out.
INTERRUPTED Ad loading was interrupted (e.g. app in background).
OTHER Unclassified error.

Show errors

Error Meaning
AD_NOT_READY show() called before ad finished loading.
AD_EXPIRED Ad was loaded too long ago - reload before showing.
OTHER Unclassified error.