com.facebook.ads.AdError Java Examples

The following examples show how to use com.facebook.ads.AdError. 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: FacebookListener.java    From mobile-sdk-android with Apache License 2.0 6 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
    Clog.d(Clog.mediationLogTag, className + " | Facebook - onError called for AdView with error message " + adError.getErrorMessage());
    ResultCode code;

    if (adError.getErrorCode() == AdError.NO_FILL.getErrorCode()) {
        code = ResultCode.UNABLE_TO_FILL;
    } else if (adError.getErrorCode() == AdError.LOAD_TOO_FREQUENTLY.getErrorCode()) {
        code = ResultCode.INVALID_REQUEST;
    } else if (adError.getErrorCode() == AdError.INTERNAL_ERROR.getErrorCode()) {
        code = ResultCode.INTERNAL_ERROR;
    } else if (adError.getErrorCode() == AdError.MISSING_PROPERTIES.getErrorCode()) {
        code = ResultCode.INVALID_REQUEST;
    } else {
        code = ResultCode.INTERNAL_ERROR;
    }

    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdFailed(code);
    }
}
 
Example #2
Source File: FacebookRewardedAd.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);

  if (showAdCalled.get()) {
    Log.w(TAG, "Failed to present rewarded ad: " + errorMessage);
    if (mRewardedAdCallback != null) {
      mRewardedAdCallback.onAdFailedToShow(errorMessage);
    }
  } else {
    Log.w(TAG, "Failed to load rewarded ad: " + errorMessage);
    if (mMediationAdLoadCallback != null) {
      mMediationAdLoadCallback.onFailure(errorMessage);
    }
  }

  rewardedAd.destroy();
}
 
Example #3
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  Log.w(TAG, errorMessage);
  FacebookAdapter.this.mBannerListener
      .onAdFailedToLoad(FacebookAdapter.this, adError.getErrorCode());
}
 
Example #4
Source File: FacebookRtbInterstitialAd.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  Log.w(TAG, errorMessage);

  if (showAdCalled.get()) {
    if (mInterstitalAdCallback != null) {
      mInterstitalAdCallback.onAdOpened();
      mInterstitalAdCallback.onAdClosed();
    }
    return;
  }

  callback.onFailure(errorMessage);
}
 
Example #5
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  if (!TextUtils.isEmpty(adError.getErrorMessage())) {
    Log.w(TAG, errorMessage);
  }
  FacebookAdapter.this.mNativeListener.onAdFailedToLoad(
      FacebookAdapter.this, adError.getErrorCode());
}
 
Example #6
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  if (!TextUtils.isEmpty(adError.getErrorMessage())) {
    Log.w(TAG, errorMessage);
  }
  FacebookAdapter.this.mNativeListener.onAdFailedToLoad(
      FacebookAdapter.this, adError.getErrorCode());
}
 
Example #7
Source File: FacebookAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  Log.w(TAG, errorMessage);

  if (showInterstitialCalled.get()) {
    FacebookAdapter.this.mInterstitialListener.onAdOpened(FacebookAdapter.this);
    FacebookAdapter.this.mInterstitialListener.onAdClosed(FacebookAdapter.this);
    return;
  }

  FacebookAdapter.this.mInterstitialListener.onAdFailedToLoad(
      FacebookAdapter.this, adError.getErrorCode());
}
 
Example #8
Source File: BannerView.java    From react-native-fbads with MIT License 5 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  WritableMap event = Arguments.createMap();

  event.putInt("errorCode", adError.getErrorCode());
  event.putString("errorMessage", adError.getErrorMessage());
  mEventEmitter.receiveEvent(getId(), "onAdError", event);

  myAdView = null;
}
 
Example #9
Source File: InterstitialAdManager.java    From react-native-fbads with MIT License 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  mPromise.reject("E_FAILED_TO_LOAD", adError.getErrorMessage());
  cleanUp();
}
 
Example #10
Source File: FacebookMediationAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
/**
 * Creates a formatted SDK error string from a given {@link AdError}.
 */
@NonNull
public static String createSdkError(@NonNull AdError error) {
  return String.format("%d: %s", error.getErrorCode(), error.getErrorMessage());
}
 
Example #11
Source File: MainActivity.java    From Instagram-Profile-Downloader with MIT License 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
    Log.e(TAG, "facebookAdsonError: " + adError.getErrorMessage());
    isFbAdsLoading = false;
}
 
Example #12
Source File: NativeAdManager.java    From react-native-fbads with MIT License 4 votes vote down vote up
@Override
public void onAdError(AdError adError) {
  String error = String.format("%d: %s", adError.getErrorCode(), adError.getErrorMessage(), Locale.ENGLISH);

  this.sendAppEvent("onAdError", error);
}
 
Example #13
Source File: FragmentSocialTimeline.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError error) {
    Logger.d("FragmentSocialTimeline"," onError "+error.getErrorMessage());
    Logger.d("FragmentSocialTimeline"," onError code:"+error.getErrorCode());
}
 
Example #14
Source File: InterstitialFragment.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError error) {
    if (ad == interstitialAd) {
        setLabel("Interstitial ad failed to load: " + error.getErrorMessage());
    }
}
 
Example #15
Source File: FacebookRtbNativeAd.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  Log.w(TAG, errorMessage);
  callback.onFailure(errorMessage);
}
 
Example #16
Source File: FacebookRtbBannerAd.java    From googleads-mobile-android-mediation with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError adError) {
  String errorMessage = createSdkError(adError);
  Log.w(TAG, errorMessage);
  callback.onFailure(errorMessage);
}
 
Example #17
Source File: BannerFragment.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError error) {
    if (ad == adViewBanner) {
        setLabel("Ad failed to load: " + error.getErrorMessage());
    }
}
 
Example #18
Source File: RectangleFragment.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
@Override
public void onError(Ad ad, AdError error) {
    if (ad == adViewRectangle) {
        setLabel("Ad failed to load: " + error.getErrorMessage());
    }
}