Android Interstitial Integration

1. Set the Interstitial Ad Delegate Method

For Java

Yodo1Mas.getInstance().setInterstitialListener(new Yodo1Mas.InterstitialListener() {
    @Override
    public void onAdOpened(@NonNull Yodo1MasAdEvent event) {
    }

    @Override
    public void onAdError(@NonNull Yodo1MasAdEvent event, @NonNull Yodo1MasError error) {
        
    }

    @Override
    public void onAdClosed(@NonNull Yodo1MasAdEvent event) {
    
    }
});      

For Kotlin

val interstitialListener: Yodo1Mas.InterstitialListener = object : Yodo1Mas.InterstitialListener() {        	
override fun onAdOpened(event: Yodo1MasAdEvent) {

        }                                                                                                               	override fun onAdError(event: Yodo1MasAdEvent, error: Yodo1MasError) {
            Toast.makeText(this@MainActivity, error.message, Toast.LENGTH_SHORT).show()
        }                                                                                                               	override fun onAdClosed(event: Yodo1MasAdEvent) {

        }
}
Yodo1Mas.getInstance().setInterstitialListener(interstitialListener)

2. Check the Loading Status of Interstitials

For Java

boolean isLoaded = Yodo1Mas.getInstance().isInterstitialAdLoaded();

For Kotlin

val isAdLoaded = Yodo1Mas.getInstance().isInterstitialAdLoaded()

3. Show Interstitial Ad

For Java

Yodo1Mas.getInstance().showInterstitialAd(MyActivity.this);

For Kotlin

Yodo1Mas.getInstance().showInterstitialAd(this@MainActivity)
Updated on September 22, 2021

Was this article helpful?

Related Articles