com.mopub.mobileads.MoPubErrorCode Java Examples
The following examples show how to use
com.mopub.mobileads.MoPubErrorCode.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppLovinCustomEventRewardedVideo.java From SDK-Network-Adapters with MIT License | 6 votes |
private static MoPubErrorCode toMoPubErrorCode(final int applovinErrorCode) { if ( applovinErrorCode == AppLovinErrorCodes.NO_FILL ) { return MoPubErrorCode.NETWORK_NO_FILL; } else if ( applovinErrorCode == AppLovinErrorCodes.UNSPECIFIED_ERROR ) { return MoPubErrorCode.NETWORK_INVALID_STATE; } else if ( applovinErrorCode == AppLovinErrorCodes.NO_NETWORK ) { return MoPubErrorCode.NO_CONNECTION; } else if ( applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT ) { return MoPubErrorCode.NETWORK_TIMEOUT; } else { return MoPubErrorCode.UNSPECIFIED; } }
Example #2
Source File: AppLovinCustomEventInterstitial.java From SDK-Network-Adapters with MIT License | 6 votes |
@Override public void showInterstitial() { final AppLovinAd preloadedAd = dequeueAd( zoneId ); if ( preloadedAd != null ) { final AppLovinInterstitialAdDialog interstitialAd = AppLovinInterstitialAd.create( sdk, context ); interstitialAd.setAdDisplayListener( this ); interstitialAd.setAdClickListener( this ); interstitialAd.setAdVideoPlaybackListener( this ); interstitialAd.showAndRender( preloadedAd ); } else { log( ERROR, "Failed to show an AppLovin interstitial before one was loaded" ); listener.onInterstitialFailed( MoPubErrorCode.NETWORK_INVALID_STATE ); } }
Example #3
Source File: AppLovinCustomEventInterstitial.java From SDK-Network-Adapters with MIT License | 6 votes |
private static MoPubErrorCode toMoPubErrorCode(final int applovinErrorCode) { if ( applovinErrorCode == AppLovinErrorCodes.NO_FILL ) { return MoPubErrorCode.NETWORK_NO_FILL; } else if ( applovinErrorCode == AppLovinErrorCodes.UNSPECIFIED_ERROR ) { return MoPubErrorCode.NETWORK_INVALID_STATE; } else if ( applovinErrorCode == AppLovinErrorCodes.NO_NETWORK ) { return MoPubErrorCode.NO_CONNECTION; } else if ( applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT ) { return MoPubErrorCode.NETWORK_TIMEOUT; } else { return MoPubErrorCode.UNSPECIFIED; } }
Example #4
Source File: MoPubConsentManager.java From aptoide-client-v8 with GNU General Public License v3.0 | 6 votes |
@Override public void showConsentDialog() { PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager(); personalInfoManager.loadConsentDialog(new ConsentDialogListener() { @Override public void onConsentDialogLoaded() { if (personalInfoManager != null && personalInfoManager.isConsentDialogReady() && !wasMoPubConsentDialogShown) { wasMoPubConsentDialogShown = true; personalInfoManager.showConsentDialog(); } } @Override public void onConsentDialogLoadFailed(@NonNull MoPubErrorCode moPubErrorCode) { Logger.getInstance() .d("MoPubConsent", "MoPub Consent dialog failed to load due to " + moPubErrorCode.toString()); } }); }
Example #5
Source File: MoPubMediationInterstitial.java From mobile-sdk-android with Apache License 2.0 | 6 votes |
@Override protected void loadInterstitial(Context context, CustomEventInterstitialListener customEventInterstitialListener, Map<String, Object> localExtras, Map<String, String> serverExtras) { Clog.d(Clog.mediationLogTag, "Initializing ANInterstitial via MoPub SDK"); listener = customEventInterstitialListener; String placementID; if (extrasAreValid(serverExtras)) { placementID = serverExtras.get(PLACEMENTID_KEY); Clog.d(Clog.mediationLogTag, String.format("Server extras were valid: placementID: %s", placementID)); } else { listener.onInterstitialFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR); Clog.e(Clog.mediationLogTag, "Failed to parse server extras. Check setup of placement in MoPub."); return; } iad = new InterstitialAdView(context); iad.setPlacementID(placementID); iad.setShouldServePSAs(false); iad.setAdListener(this); Clog.d(Clog.mediationLogTag, "Fetch ANInterstitial"); iad.loadAd(); }
Example #6
Source File: MoPubMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 6 votes |
@Override public void onRewardedVideoLoadFailure(@NonNull String adUnitId, @NonNull MoPubErrorCode errorCode) { String errorSDKMessage = createSDKError(errorCode); Log.w(TAG, errorSDKMessage); // MoPub Rewarded video ads expire after 4 hours. if (errorCode == MoPubErrorCode.EXPIRED) { MoPubSingleton.getInstance().adExpired(adUnitId, MoPubMediationAdapter.this); adExpired = true; } if (mAdLoadCallback != null) { mAdLoadCallback.onFailure(errorSDKMessage); } }
Example #7
Source File: AppLovinCustomEventBanner.java From SDK-Network-Adapters with MIT License | 6 votes |
private static MoPubErrorCode toMoPubErrorCode(final int applovinErrorCode) { if ( applovinErrorCode == AppLovinErrorCodes.NO_FILL ) { return MoPubErrorCode.NETWORK_NO_FILL; } else if ( applovinErrorCode == AppLovinErrorCodes.UNSPECIFIED_ERROR ) { return MoPubErrorCode.NETWORK_INVALID_STATE; } else if ( applovinErrorCode == AppLovinErrorCodes.NO_NETWORK ) { return MoPubErrorCode.NO_CONNECTION; } else if ( applovinErrorCode == AppLovinErrorCodes.FETCH_AD_TIMEOUT ) { return MoPubErrorCode.NETWORK_TIMEOUT; } else { return MoPubErrorCode.UNSPECIFIED; } }
Example #8
Source File: AppLovinCustomEventRewardedVideo.java From SDK-Network-Adapters with MIT License | 6 votes |
@Override protected void showVideo() { if ( hasVideoAvailable() ) { fullyWatched = false; reward = null; incentivizedInterstitial.show( parentActivity, null, this, this, this, this ); } else { log( ERROR, "Failed to show an AppLovin rewarded video before one was loaded" ); MoPubRewardedVideoManager.onRewardedVideoPlaybackError( getClass(), "", MoPubErrorCode.VIDEO_PLAYBACK_ERROR ); } }
Example #9
Source File: SomaMopubVideoAdapter.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void onFailedToLoadAd() { new CrashReportTemplate<Void>() { @Override public Void process() { handler.post(new Runnable() { @Override public void run() { customEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.NO_FILL); } }); return null; } }.execute(); }
Example #10
Source File: AppnextBaseAdapterConfiguration.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void initializeNetwork(@NonNull Context context, @Nullable Map<String, String> configuration, @NonNull OnNetworkInitializationFinishedListener listener) { Appnext.init(context); listener.onNetworkInitializationFinished(this.getClass(), MoPubErrorCode.ADAPTER_INITIALIZATION_SUCCESS); }
Example #11
Source File: AppLovinBaseAdapterConfiguration.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void initializeNetwork(@NonNull Context context, @Nullable Map<String, String> configuration, @NonNull OnNetworkInitializationFinishedListener listener) { AppLovinSdk.initializeSdk(context); listener.onNetworkInitializationFinished(this.getClass(), MoPubErrorCode.ADAPTER_INITIALIZATION_SUCCESS); }
Example #12
Source File: SomaMopubAdapterInterstitial.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void onFailedToLoadAd() { new CrashReportTemplate<Void>() { @Override public Void process() { handler.post(new Runnable() { @Override public void run() { customEventInterstitialListener.onInterstitialFailed(MoPubErrorCode.NO_FILL); } }); return null; } }.execute(); }
Example #13
Source File: InneractiveAdapterConfiguration.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void initializeNetwork(@NonNull Context context, @Nullable Map<String, String> configuration, @NonNull OnNetworkInitializationFinishedListener listener) { Preconditions.checkNotNull(context); Preconditions.checkNotNull(listener); boolean initializeNetworkSuccess = false; synchronized (InneractiveAdapterConfiguration.class) { try { if (configuration != null && !TextUtils.isEmpty(configuration.get(REMOTE_KEY_APP_ID))) { final String appId = configuration.get(REMOTE_KEY_APP_ID); InneractiveAdManager.initialize(context, appId); initializeNetworkSuccess = true; } } catch (Exception e) { MoPubLog.log(CUSTOM_WITH_THROWABLE, "Initializing Inneractive has encountered " + "an exception.", e); } } if (initializeNetworkSuccess) { listener.onNetworkInitializationFinished(InneractiveAdapterConfiguration.class, MoPubErrorCode.ADAPTER_INITIALIZATION_SUCCESS); } else { listener.onNetworkInitializationFinished(InneractiveAdapterConfiguration.class, MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR); } }
Example #14
Source File: InMobiRewardedCustomEvent.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override protected void showVideo() { if (this.hasVideoAvailable()) { inmobiInterstitial.show(); } else { MoPubRewardedVideoManager.onRewardedVideoPlaybackError(InMobiRewardedCustomEvent.class, placementId, MoPubErrorCode.VIDEO_PLAYBACK_ERROR); } }
Example #15
Source File: InMobiRewardedCustomEvent.java From aptoide-client-v8 with GNU General Public License v3.0 | 5 votes |
@Override public void onAdLoadFailed(InMobiInterstitial ad, InMobiAdRequestStatus status) { Log.v(TAG, "Ad failed to load:" + status.getStatusCode() .toString()); if (status.getStatusCode() == StatusCode.INTERNAL_ERROR) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.INTERNAL_ERROR); } else if (status.getStatusCode() == StatusCode.REQUEST_INVALID) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR); } else if (status.getStatusCode() == StatusCode.NETWORK_UNREACHABLE) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.NETWORK_INVALID_STATE); } else if (status.getStatusCode() == StatusCode.NO_FILL) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.NO_FILL); } else if (status.getStatusCode() == StatusCode.REQUEST_TIMED_OUT) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.NETWORK_TIMEOUT); } else if (status.getStatusCode() == StatusCode.SERVER_ERROR) { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.SERVER_ERROR); } else { MoPubRewardedVideoManager.onRewardedVideoLoadFailure(InMobiRewardedCustomEvent.class, getAdNetworkId(), MoPubErrorCode.UNSPECIFIED); } }
Example #16
Source File: MoPubMediationBanner.java From mobile-sdk-android with Apache License 2.0 | 5 votes |
@Override protected void loadBanner(Context context, CustomEventBannerListener customEventBannerListener, Map<String, Object> localExtras, Map<String, String> serverExtras) { Clog.d(Clog.mediationLogTag, "Initializing ANBanner via MoPub SDK"); this.listener = customEventBannerListener; String placementID; int width; int height; if (extrasAreValid(serverExtras)) { placementID = serverExtras.get(PLACEMENTID_KEY); width = Integer.parseInt(serverExtras.get(AD_WIDTH_KEY)); height = Integer.parseInt(serverExtras.get(AD_HEIGHT_KEY)); Clog.d(Clog.mediationLogTag, String.format("Server extras were valid: placementID: %s, width: %s, height: %s", placementID, width, height)); } else { listener.onBannerFailed(MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR); Clog.e(Clog.mediationLogTag, "Failed to parse server extras. Check setup of placement in MoPub."); return; } bav = new BannerAdView(context); bav.setPlacementID(placementID); bav.setAdSize(width, height); bav.setShouldServePSAs(false); bav.setAdListener(this); Clog.d(Clog.mediationLogTag, "Load ANBanner"); bav.loadAdOffscreen(); }
Example #17
Source File: MoPubMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 5 votes |
@Override public void onRewardedVideoPlaybackError(@NonNull String adUnitId, @NonNull MoPubErrorCode errorCode) { String errorSDKMessage = createSDKError(errorCode); Log.i(TAG, "Failed to playback MoPub rewarded video: " + errorSDKMessage); if (mRewardedAdCallback != null) { mRewardedAdCallback.onAdFailedToShow(errorSDKMessage); } }
Example #18
Source File: MoPubAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 5 votes |
@Override public void onBannerFailed(MoPubView moPubView, MoPubErrorCode moPubErrorCode) { String errorSDKMessage = createSDKError(moPubErrorCode); Log.w(TAG, errorSDKMessage); mMediationBannerListener .onAdFailedToLoad(MoPubAdapter.this, getMediationErrorCode(moPubErrorCode)); }
Example #19
Source File: MoPubAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 5 votes |
@Override public void onInterstitialFailed(MoPubInterstitial moPubInterstitial, MoPubErrorCode moPubErrorCode) { String errorSDKMessage = createSDKError(moPubErrorCode); Log.w(TAG, errorSDKMessage); mMediationInterstitialListener .onAdFailedToLoad(MoPubAdapter.this, getMediationErrorCode(moPubErrorCode)); }
Example #20
Source File: MoPubSingleton.java From googleads-mobile-android-mediation with Apache License 2.0 | 5 votes |
@Override public void onRewardedVideoLoadFailure(@NonNull String adUnitId, @NonNull MoPubErrorCode errorCode) { if (hasListener(adUnitId)) { mListeners.get(adUnitId).get().onRewardedVideoLoadFailure(adUnitId, errorCode); } mListeners.remove(adUnitId); }
Example #21
Source File: MoPubSingleton.java From googleads-mobile-android-mediation with Apache License 2.0 | 5 votes |
@Override public void onRewardedVideoPlaybackError(@NonNull String adUnitId, @NonNull MoPubErrorCode errorCode) { if (hasListener(adUnitId)) { mListeners.get(adUnitId).get().onRewardedVideoPlaybackError(adUnitId, errorCode); } mListeners.remove(adUnitId); }
Example #22
Source File: MoPubMediationInterstitial.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
@Override public void onAdRequestFailed(AdView adView, ResultCode resultCode) { Clog.d(Clog.mediationLogTag, "ANInterstitial failed to load: " + resultCode); if (listener != null) listener.onInterstitialFailed(MoPubErrorCode.UNSPECIFIED); }
Example #23
Source File: MoPubListener.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
public void handleMPErrorCode(MoPubErrorCode mpError) { ResultCode code = ResultCode.INTERNAL_ERROR; switch (mpError) { case INTERNAL_ERROR: code = ResultCode.INTERNAL_ERROR; break; case NO_FILL: code = ResultCode.UNABLE_TO_FILL; break; case SERVER_ERROR: code = ResultCode.NETWORK_ERROR; break; case CANCELLED: code = ResultCode.INTERNAL_ERROR; break; case ADAPTER_NOT_FOUND: code = ResultCode.MEDIATED_SDK_UNAVAILABLE; break; case ADAPTER_CONFIGURATION_ERROR: code = ResultCode.MEDIATED_SDK_UNAVAILABLE; break; case NETWORK_TIMEOUT: code = ResultCode.NETWORK_ERROR; break; case NETWORK_NO_FILL: code = ResultCode.UNABLE_TO_FILL; break; case NETWORK_INVALID_STATE: code = ResultCode.NETWORK_ERROR; break; case MRAID_LOAD_ERROR: code = ResultCode.INTERNAL_ERROR; break; case VIDEO_CACHE_ERROR: code = ResultCode.INTERNAL_ERROR; break; case VIDEO_DOWNLOAD_ERROR: code = ResultCode.NETWORK_ERROR; break; case UNSPECIFIED: code = ResultCode.INTERNAL_ERROR; break; } if (mediatedAdViewController != null) { mediatedAdViewController.onAdFailed(code); } }
Example #24
Source File: MoPubMediationBanner.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
@Override public void onAdRequestFailed(AdView adView, ResultCode resultCode) { Clog.d(Clog.mediationLogTag, "ANBanner failed to load: " + resultCode); if (listener != null) listener.onBannerFailed(MoPubErrorCode.UNSPECIFIED); }
Example #25
Source File: MoPubListener.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
public void onBannerFailed(MoPubView banner, MoPubErrorCode errorCode) { Clog.d(Clog.mediationLogTag, className + " | MoPub - onBannerFailed called for MoPubView with ErrorCode: " + errorCode); handleMPErrorCode(errorCode); }
Example #26
Source File: MoPubListener.java From mobile-sdk-android with Apache License 2.0 | 4 votes |
@Override public void onInterstitialFailed(MoPubInterstitial interstitial, MoPubErrorCode errorCode) { Clog.d(Clog.mediationLogTag, "MoPub - onInterstitialFailed called for MoPubInterstitial with ErrorCode: " + errorCode); handleMPErrorCode(errorCode); }
Example #27
Source File: DemoActivity.java From prebid-mobile-android with Apache License 2.0 | 4 votes |
@Override public void onRewardedVideoLoadFailure(@NonNull String adUnitId, @NonNull MoPubErrorCode errorCode) { LogUtil.d("onRewardedVideoLoadFailure:" + errorCode); }
Example #28
Source File: AppLovinCustomEventInterstitial.java From SDK-Network-Adapters with MIT License | 4 votes |
@Override public void loadInterstitial(final Context context, final CustomEventInterstitialListener listener, final Map<String, Object> localExtras, final Map<String, String> serverExtras) { log( DEBUG, "Requesting AppLovin interstitial with serverExtras: " + serverExtras + " and localExtras: " + localExtras ); // SDK versions BELOW 7.2.0 require a instance of an Activity to be passed in as the context if ( AppLovinSdk.VERSION_CODE < 720 && !( context instanceof Activity ) ) { log( ERROR, "Unable to request AppLovin banner. Invalid context provided." ); listener.onInterstitialFailed( MoPubErrorCode.ADAPTER_CONFIGURATION_ERROR ); return; } // Pass the user consent from the MoPub SDK as per GDPR PersonalInfoManager personalInfoManager = MoPub.getPersonalInformationManager(); if ( personalInfoManager != null && personalInfoManager.gdprApplies() ) { boolean canCollectPersonalInfo = personalInfoManager.canCollectPersonalInformation(); AppLovinPrivacySettings.setHasUserConsent( canCollectPersonalInfo, context ); } // Store parent objects this.listener = listener; this.context = context; sdk = retrieveSdk( serverExtras, context ); sdk.setPluginVersion( "MoPub-3.0.0" ); // Zones support is available on AppLovin SDK 7.5.0 and higher final String serverExtrasZoneId = serverExtras != null ? serverExtras.get( "zone_id" ) : null; zoneId = ( !TextUtils.isEmpty( serverExtrasZoneId ) && AppLovinSdk.VERSION_CODE >= 750 ) ? serverExtrasZoneId : DEFAULT_ZONE; // Check if we already have a preloaded ad for the given zone final AppLovinAd preloadedAd = dequeueAd( zoneId ); if ( preloadedAd != null ) { log( DEBUG, "Found preloaded ad for zone: {" + zoneId + "}" ); adReceived( preloadedAd ); } else { // If this is a default Zone, create the incentivized ad normally if ( DEFAULT_ZONE.equals( zoneId ) ) { sdk.getAdService().loadNextAd( AppLovinAdSize.INTERSTITIAL, this ); } // Otherwise, use the Zones API else { sdk.getAdService().loadNextAdForZoneId( zoneId, this ); } } }
Example #29
Source File: MoPubMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 4 votes |
public static int getMediationErrorCode(@NonNull MoPubErrorCode moPubErrorCode) { switch (moPubErrorCode) { case AD_SUCCESS: return 0; case DO_NOT_TRACK: return 1; case UNSPECIFIED: return 2; case NO_FILL: return 3; case WARMUP: return 4; case SERVER_ERROR: return 5; case INTERNAL_ERROR: return 6; case RENDER_PROCESS_GONE_WITH_CRASH: return 7; case RENDER_PROCESS_GONE_UNSPECIFIED: return 8; case CANCELLED: return 9; case MISSING_AD_UNIT_ID: return 10; case NO_CONNECTION: return 11; case ADAPTER_NOT_FOUND: return 12; case ADAPTER_CONFIGURATION_ERROR: return 13; case ADAPTER_INITIALIZATION_SUCCESS: return 14; case EXPIRED: return 15; case NETWORK_TIMEOUT: return 16; case NETWORK_NO_FILL: return 17; case NETWORK_INVALID_STATE: return 18; case MRAID_LOAD_ERROR: return 19; case VIDEO_CACHE_ERROR: return 20; case VIDEO_DOWNLOAD_ERROR: return 21; case GDPR_DOES_NOT_APPLY: return 22; case REWARDED_CURRENCIES_PARSING_ERROR: return 23; case REWARD_NOT_SELECTED: return 24; case VIDEO_NOT_AVAILABLE: return 25; case VIDEO_PLAYBACK_ERROR: return 26; } // Error '99' to indicate that the error is new and has not been supported by the adapter yet. return 99; }
Example #30
Source File: MoPubMediationAdapter.java From googleads-mobile-android-mediation with Apache License 2.0 | 4 votes |
public static String createSDKError(@NonNull MoPubErrorCode error) { return String.format("%d: %s", getMediationErrorCode(error), error.toString()); }