use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class PrebidBannerAdapter method getListener.
@NonNull
private DisplayViewListener getListener(CustomEventBannerListener adMobListener) {
return new DisplayViewListener() {
@Override
public void onAdLoaded() {
adMobListener.onAdLoaded(adView);
}
@Override
public void onAdDisplayed() {
}
@Override
public void onAdFailed(AdException exception) {
String message = exception.getMessage();
if (message == null)
message = "Failed to load DisplayView ad";
adMobListener.onAdFailedToLoad(new AdError(1010, message, "prebid"));
}
@Override
public void onAdClicked() {
adMobListener.onAdClicked();
adMobListener.onAdOpened();
}
@Override
public void onAdClosed() {
adMobListener.onAdClosed();
}
};
}
use of org.prebid.mobile.rendering.errors.AdException 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();
}
};
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class InterstitialController method loadAd.
public void loadAd(String responseId, boolean isRewarded) {
BidResponse bidResponse = BidResponseCache.getInstance().popBidResponse(responseId);
if (bidResponse == null) {
if (mListener != null) {
mListener.onInterstitialFailedToLoad(new AdException(AdException.INTERNAL_ERROR, "No bid response found in the cache"));
}
return;
}
AdConfiguration adUnitConfiguration = new AdConfiguration();
adUnitConfiguration.setRewarded(isRewarded);
loadAd(adUnitConfiguration, bidResponse);
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class VideoView method init.
@Override
protected void init() throws AdException {
try {
super.init();
setAdViewManagerValues();
setBackgroundColor(ContextCompat.getColor(getContext(), android.R.color.black));
registerEventBroadcast();
} catch (Exception e) {
throw new AdException(AdException.INIT_ERROR, "VideoAdView initialization failed: " + Log.getStackTraceString(e));
}
}
use of org.prebid.mobile.rendering.errors.AdException in project prebid-mobile-android by prebid.
the class AdConfigurationTest method testAdConfiguration.
@Test
public void testAdConfiguration() {
AdConfiguration adConfig = null;
AdException err = null;
adConfig = new AdConfiguration();
assertNotNull(adConfig);
assertNull(err);
assertEquals(PrebidRenderingSettings.AUTO_REFRESH_DELAY_DEFAULT, adConfig.getAutoRefreshDelay());
}
Aggregations