Documentation

Waterfall

Integration remains consistent with the approach outlined in Google AdMob, ensuring seamless compatibility with existing configurations. No further modifications are necessary, streamlining the implementation process and minimizing any additional overhead.

Prebid

Overview

Loading rewarded ads consists of several stages:

  1. Loading BidMachine RewardedRequest
  2. Setting up AdMob AdRequest by loaded BidMachine RewardedRequest
  3. Loading AdMob RewardedAd with configured AdMob AdRequest

Loading BidMachine RewardedRequest

Create a new RewardedRequest instance with AdRequestListener.
Execute request on the RewardedRequest instance to start loading.
When the onRequestSuccess callback is triggered, it means that the request has been successfully loaded and you can proceed to AdMob AdRequest settings.

// Create new BidMachine RewardedRequest instance
RewardedRequest rewardedRequest = BidMachineAdRequestBuilderFactory.createRewardedRequestBuilder()
        .setListener(new RewardedRequest.AdRequestListener() {
            @Override
            public void onRequestSuccess(@NonNull RewardedRequest rewardedRequest,
                                         @NonNull AuctionResult auctionResult) {
                runOnUiThread(() -> loadAdMobRewarded(rewardedRequest));
            }
        })
        .build();

// Request an ad from BidMachine without loading it
rewardedRequest.request(...);
// Create new BidMachine request
val rewardedRequest = BidMachineAdRequestBuilderFactory.createRewardedRequestBuilder()
        .setListener(object : RewardedRequest.AdRequestListener {
            override fun onRequestSuccess(rewardedRequest: RewardedRequest, auctionResult: AuctionResult) {
                runOnUiThread { loadAdMobRewarded(rewardedRequest) }
            }
        })
        .build().also {
            // Request an ad from BidMachine without loading it
            it.request(context)
        }

Setting up AdMob AdRequest

Ways to set up AdMob AdRequest by BidMachine RewardedRequest:

  1. Create a new AdMob AdRequest instance
AdRequest adRequest = BidMachineUtils.createAdRequest(rewardedRequest);
val adRequest = BidMachineUtils.createAdRequest(rewardedRequest)
  1. Create a new AdMob AdRequest.Builder instance
AdRequest.Builder adRequestBuilder =
    BidMachineUtils.createAdRequestBuilder(rewardedRequest);
AdRequest adRequest = adRequestBuilder.build();
val adRequestBuilder = BidMachineUtils.createAdRequestBuilder(rewardedRequest)
val adRequest = adRequestBuilder.build()
  1. Fill an existing AdMob AdRequest.Builder instance
AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
BidMachineUtils.appendRequest(adRequestBuilder, rewardedRequest);
AdRequest adRequest = adRequestBuilder.build();
val adRequestBuilder = AdRequest.Builder()
BidMachineUtils.appendRequest(adRequestBuilder, rewardedRequest)
val adRequest = adRequestBuilder.build()

Loading AdMob RewardedAd

Use the AdMob AdRequest that was created during the previous step to load the AdMob RewardedAd

RewardedAd.load(..., ..., adRequest, ...);
RewardedAd.load(..., ..., adRequest, ...)

📘

Sample App

You can find Sample App with BidMachineSDK and AdMob here: Github Rewarded