SDK Implementation Guide
  • 📱SDK Implementation Guide
  • How to Configure
    • 💡Initialising the SDK
  • How to Render an Ad
    • 📪Banner Ad
    • 📪Interstitial Ad
    • 📪Rewarded Ad
    • 📪Native Ad
    • 📪Custom Native Ad
  • Beta Ad Format's
    • 🎨App open (Beta)
    • 🎨In-stream Video (Beta)
  • Feature's only for GAM
    • 🎨Adaptive Banner Ad (Only for GAM)
    • 🎨Render Unified Ad (Only for GAM)
    • 🎨How to pass predefined custom targeting values in ad request (Only for GAM)
    • 🎨How to pass publisher provided identifiers in ad request (PPID) (Only for GAM)
    • TEST AD UNITS
  • Manifest Changes Required for SDK
  • Integrate Ads & APP Ads For Easy Management
Powered by GitBook
On this page

Was this helpful?

  1. How to Render an Ad

Rewarded Ad

Below are the steps to load and show a rewarded ad on your app

  1. Create your AdRequestConfiguration as per the below format

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

AdSterAdLoader.Companion.builder().withAdsListener(new MediationAdListener(){
    @Override
    public void onRewardedAdLoaded(@NonNull MediationRewardedAd ad) {
        super.onRewardedAdLoaded(ad);
        //Show Rewarded ad here
    }

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

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

    @Override
    public void onUserEarnedReward(@NonNull Reward reward) {
        //Handle ad click here
    }

    @Override
    public void onVideoComplete() {
        //Handle ad click here
    }

    @Override
    public void onVideoClosed() {
        //Handle ad click here
    }

    @Override
    public void onVideoStart() {
        //Handle ad click here
    }
}).build().loadAd(configuration.build());
AdSterAdLoader.builder().withAdsListener(object : MediationAdListener() {
    override fun onRewardedAdLoaded(ad: MediationRewardedAd) {
        super.onRewardedAdLoaded(ad)
        //Show Rewarded ad here
    }

    override fun onFailure(adError: AdError) {
        //Handle failure callback here
    }
}).withRewardedAdEventsListener(object : RewardedAdEventsListener() {
    override fun onAdClicked() {
        //Handle ad click here
    }

    override fun onAdImpression() {
        //Handle ad click here
    }

    override fun onUserEarnedReward(reward: Reward) {
        //Handle ad click here
    }

    override fun onVideoComplete() {
        //Handle ad click here
    }

    override fun onVideoClosed() {
        //Handle ad click here
    }

    override fun onVideoStart() {
        //Handle ad click here
    }
}).build().loadAd(configuration.build())
  1. Inside the onRewardedAdLoaded callback method invoke showAd(activity) method of MediationRewardedAd object to show AdSter rewarded ad above any activity as shown below

@Override
public void onRewardedAdLoaded(@NonNull MediationRewardedAd ad) {
  super.onRewardedAdLoaded(ad);
  ad.showAd(activity);
}
override fun onRewardedAdLoaded (ad: MediationRewardedAd) {
    super.onRewardedAdLoaded (ad)
    ad.showAd(activity);
}
  1. Make sure to pass only Activity`s context as parameter to showAd()

PreviousInterstitial AdNextNative Ad

Last updated 1 year ago

Was this helpful?

📪