Skip to main content

Splash Ad Units

Create Splash Ad Unit#

info

If you miss to Initialize the SDK, this method will fail to return a response.

To create a native splash ad, first create an MesonSplash object.

val splashAd = MesonSplash(this,AD_UNIT_ID, AdSize(width, height))

Set the Listener#

Track the ad lifecycle for splash ads. All the available events for splash ads are listed below.

splashAd.setAdListener(object:MesonSplashAdListener(){
override fun onAdLoadSucceeded(splashAd: MesonSplash) {
}
override fun onAdLoadFailed(splashAd: MesonSplash, status: MesonAdRequestStatus) {
}
override fun onAdClicked(splashAd: MesonSplash, params: HashMap<String, Any>) {
}
override fun onAdImpression(splashAd: MesonSplash, impressionData:JSONObject?) {
}
override fun onAdDisplayed(splashAd: MesonSplash) {
}
override fun onUserLeftApplication(splashAd: MesonSplash) {
}
})

Load Ad#

The publisher can request for an splash ad by invoking this method. This will request an ad from all demand sources, select a winner, and make it available on the SDK.

splashAd.load()

Get Ad View#

The ad is returned to the user when getAdView method is called. It is recommended to call this method in the onAdLoadSucceeded callback method.

//Create NativeAdViewConfiguration object
val adViewConfiguration = MesonNativeAdViewConfiguration.Builder()
.setParentView(<adContainer>).setConvertView(<converView>).setParentViewWdith(adSize!!.width).build()
//Call getAdView
splashAd.getAdView(MesonNativeAdViewConfiguration)