Rewarded
Overview
Loading rewarded ads consists of several stages:
- Loading BidMachine RewardedRequest
- Setting up AdMob AdRequest by loaded BidMachine RewardedRequest
- 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 = new RewardedRequest.Builder()
.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(...);
Setting up AdMob AdRequest
Ways to set up AdMob AdRequest by BidMachine RewardedRequest:
- Create a new AdMob AdRequest instance
AdRequest adRequest = BidMachineUtils.createAdRequest(rewardedRequest);
- Create a new AdMob AdRequest.Builder instance
AdRequest.Builder adRequestBuilder =
BidMachineUtils.createAdRequestBuilder(rewardedRequest);
AdRequest adRequest = adRequestBuilder.build();
- Fill an existing AdMob AdRequest.Builder instance
AdRequest.Builder adRequestBuilder = new AdRequest.Builder();
BidMachineUtils.appendRequest(adRequestBuilder, rewardedRequest);
AdRequest 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, ...);
Sample App
You can find Sample App with BidMachineSDK and AdMob here: Github Rewarded
Updated 16 days ago
What’s Next