use of com.google.android.gms.ads.mediation.MediationRewardedAd in project prebid-mobile-android by prebid.
the class PrebidRewardedAdapter method getListener.
private InterstitialControllerListener getListener(MediationAdLoadCallback<MediationRewardedAd, MediationRewardedAdCallback> adMobCallback) {
return new InterstitialControllerListener() {
@Override
public void onInterstitialReadyForDisplay() {
rewardedAdCallback = adMobCallback.onSuccess(context -> {
interstitialController.show();
});
}
@Override
public void onInterstitialDisplayed() {
rewardedAdCallback.onAdOpened();
rewardedAdCallback.onVideoStart();
rewardedAdCallback.reportAdImpression();
}
@Override
public void onInterstitialClicked() {
rewardedAdCallback.reportAdClicked();
}
@Override
public void onInterstitialFailedToLoad(AdException exception) {
String errorMessage = exception.getMessage() != null ? exception.getMessage() : "Failed to load ad";
AdError adError = new AdError(1006, errorMessage, "prebid");
adMobCallback.onFailure(adError);
if (rewardedAdCallback != null) {
rewardedAdCallback.onAdFailedToShow(adError);
}
}
@Override
public void onInterstitialClosed() {
rewardedAdCallback.onVideoComplete();
rewardedAdCallback.onAdClosed();
}
};
}
Aggregations