For the complete documentation index, see llms.txt. This page is also available as Markdown.

πŸ“ͺInterstitial Ad

Below are the steps to load and show an Interstitial ad on your app

  1. Create your AdRequestConfiguration as per the below format

val configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");
AdRequestConfiguration.Builder configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");
val configuration = AdRequestConfiguration.builder(context, "Your_placement_name")
  1. Call loadAd() method as per below format

AdSterAdLoader.Companion.builder().withAdsListener(new MediationAdListener(){
    @Override
    public void onInterstitialAdLoaded(@NonNull MediationInterstitialAd ad) {
        super.onInterstitialAdLoaded(ad);
        //Show interstitial ad here
    }

    @Override
    public void onFailure(@NonNull AdError adError) {
        //Handle failure callback here
    }
}).withInterstitialAdEventsListener(new InterstitialAdEventsListener() {
    @Override
    public void onAdClicked() {
        //Handle ad click here
    }

    @Override
    public void onAdImpression() {
        //Handle ad impression here
    }

    @Override
    public void onAdOpened() {
        //Handle ad open here
    }

    @Override
    public void onAdClosed() {
        //Handle ad closed here
    }
    
    @Override
    public void onAdRevenuePaid(double revenue, @NotNull String adUnitId,@NotNull String network, @NotNull String currency, @NotNull PrecisionType precisionType) {
        // Callback which provides revenue and the network which provided it
    }
}).build().loadAd(configuration.build());
  1. Inside the onInterstitialAdLoaded callback method invoke showAd(activity) method of MediationInterstitialAd object to show AdSter interstitial ad above any activity as shown below

  1. Make sure to pass only Activity`s context as parameter to showAd()

Last updated