πŸ“ͺNative Reward Ad

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

  1. Create your AdRequestConfiguration as per the below format

AdRequestConfiguration.Builder configuration = AdRequestConfiguration.Companion.builder(context, "Your_placement_name");
  1. Adding PPID to AdRequest

configuration.publisherProvidedId("YOUR_PPID");
  1. Call loadAd() method as per below format

AdSterAdLoader.Companion.builder().withAdsListener(new MediationAdListener() {
    @Override
    public void onNativeRewardAdLoaded(@NonNull MediationNativeRewardAd ad) {
        super.onNativeRewardAdLoaded(ad);
        //Show native reward ad here
    }

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

    @Override
    public void onAdImpression() {
        //Handle ad impression 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 onNativeRewardAdLoaded callback method use MediationNativeRewardAd object to display native reward ad on your defined layout.

  2. The layout below is only an example. The client app can design the reward UI independently.

  1. The above sample layout can be used with the MediationNativeRewardAd object to render an ad as shown in the below example

Make sure to call trackViews and set NativeRewardAd method before adding MediationNativeRewardAdView to the container.

Last updated