Java Code Examples for com.google.android.gms.ads.AdRequest#ERROR_CODE_INVALID_REQUEST

The following examples show how to use com.google.android.gms.ads.AdRequest#ERROR_CODE_INVALID_REQUEST . 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: InterstitialListener.java    From ANEAdMob with Apache License 2.0 7 votes vote down vote up
@Override
public void onAdFailedToLoad(int errorCode)
{
  String errorReason = "";
  switch(errorCode)
  {
    case AdRequest.ERROR_CODE_INTERNAL_ERROR:
      errorReason = "Internal error";
      break;
    case AdRequest.ERROR_CODE_INVALID_REQUEST:
      errorReason = "Invalid request";
      break;
    case AdRequest.ERROR_CODE_NETWORK_ERROR:
      errorReason = "Network Error";
      break;
    case AdRequest.ERROR_CODE_NO_FILL:
      errorReason = "No fill";
      break;
  }
 
  _ctx.dispatchStatusEventAsync("AD_SHOW_FAIL", errorReason);
}
 
Example 2
Source File: GooglePlayAdListener.java    From mobile-sdk-android with Apache License 2.0 7 votes vote down vote up
@Override
public void onAdFailedToLoad(int errorCode) {
    super.onAdFailedToLoad(errorCode);
    printToClog("onAdFailedToLoad with error code " + errorCode);

    ResultCode code = ResultCode.INTERNAL_ERROR;

    switch (errorCode) {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            code = ResultCode.INTERNAL_ERROR;
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            code = ResultCode.INVALID_REQUEST;
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            code = ResultCode.NETWORK_ERROR;
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            code = ResultCode.UNABLE_TO_FILL;
            break;
        default:
            break;
    }

    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdFailed(code);
    }
}
 
Example 3
Source File: AdMobNativeListener.java    From mobile-sdk-android with Apache License 2.0 7 votes vote down vote up
@Override
public void onAdFailedToLoad(int errorCode) {
    Clog.e(Clog.mediationLogTag, "AdMob - onAdFailedToLoad");
    if (mBC != null) {
        ResultCode code = ResultCode.INTERNAL_ERROR;
        switch (errorCode) {
            case AdRequest.ERROR_CODE_INTERNAL_ERROR:
                code = ResultCode.INTERNAL_ERROR;
                break;
            case AdRequest.ERROR_CODE_INVALID_REQUEST:
                code = ResultCode.INVALID_REQUEST;
                break;
            case AdRequest.ERROR_CODE_NETWORK_ERROR:
                code = ResultCode.NETWORK_ERROR;
                break;
            case AdRequest.ERROR_CODE_NO_FILL:
                code = ResultCode.UNABLE_TO_FILL;
                break;
            default:
                break;
        }
        mBC.onAdFailed(code);
    }
}
 
Example 4
Source File: AndroidAdMobRewardedVideo.java    From QtAndroidTools with MIT License 6 votes vote down vote up
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode)
{
    int errorId = 0;

    switch(errorCode)
    {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            errorId = ERROR_INTERNAL;
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            errorId = ERROR_NETWORK;
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            errorId = ERROR_INVALID_REQUEST;
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            errorId = ERROR_NO_FILL;
            break;
    }

    rewardedVideoError(errorId);
}
 
Example 5
Source File: AndroidAdMobBanner.java    From QtAndroidTools with MIT License 6 votes vote down vote up
public void onAdFailedToLoad(int errorCode)
{
    int errorId = 0;

    switch(errorCode)
    {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            errorId = ERROR_INTERNAL;
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            errorId = ERROR_NETWORK;
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            errorId = ERROR_INVALID_REQUEST;
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            errorId = ERROR_NO_FILL;
            break;
    }

    bannerError(errorId);
}
 
Example 6
Source File: AndroidAdMobInterstitial.java    From QtAndroidTools with MIT License 6 votes vote down vote up
public void onAdFailedToLoad(int errorCode)
{
    int errorId = 0;

    switch(errorCode)
    {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            errorId = ERROR_INTERNAL;
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            errorId = ERROR_NETWORK;
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            errorId = ERROR_INVALID_REQUEST;
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            errorId = ERROR_NO_FILL;
            break;
    }

    interstitialError(errorId);
}
 
Example 7
Source File: AdImpl.java    From rebootmenu with GNU General Public License v3.0 6 votes vote down vote up
private static void adErrorCodeReport(int errorCode) {
    switch (errorCode) {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            EventStatistics.record(EventStatistics.AD_STATUS_CODE, adStatusCode[0]);
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            EventStatistics.record(EventStatistics.AD_STATUS_CODE, adStatusCode[1]);
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            EventStatistics.record(EventStatistics.AD_STATUS_CODE, adStatusCode[2]);
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            EventStatistics.record(EventStatistics.AD_STATUS_CODE, adStatusCode[3]);
            break;
    }
}
 
Example 8
Source File: AbstractExecutor.java    From cordova-plugin-admob-free with MIT License 6 votes vote down vote up
/**
 * Gets a string error reason from an error code.
 */
public static String getErrorReason(int errorCode) {
    String errorReason = "";
    switch (errorCode) {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            errorReason = "Internal error";
            break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            errorReason = "Invalid request";
            break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            errorReason = "Network Error";
            break;
        case AdRequest.ERROR_CODE_NO_FILL:
            errorReason = "No fill";
            break;
    }
    return errorReason;
}
 
Example 9
Source File: ErrorUtil.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
static int convertErrorCodeFromNendVideoToAdMob(int errorCode) {
  switch (errorCode) {
    case HttpURLConnection.HTTP_NO_CONTENT:
      return AdRequest.ERROR_CODE_NO_FILL;

    case HttpURLConnection.HTTP_BAD_REQUEST:
      return AdRequest.ERROR_CODE_INVALID_REQUEST;

    case NEND_SDK_NETWORK_ERROR_CODE:
      return AdRequest.ERROR_CODE_NETWORK_ERROR;

    case HttpURLConnection.HTTP_INTERNAL_ERROR:
    default:
      return AdRequest.ERROR_CODE_INTERNAL_ERROR;
  }
}
 
Example 10
Source File: AdapterHelper.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
/**
 * Convert i-mobile fail reason to AdMob error code.
 *
 * @param reason i-mobile fail reason
 * @return AdMob error code
 */
public static int convertToAdMobErrorCode(FailNotificationReason reason) {
  // Convert i-mobile fail reason to AdMob error code.
  switch (reason) {
    case RESPONSE:
    case UNKNOWN:
      return AdRequest.ERROR_CODE_INTERNAL_ERROR;
    case PARAM:
    case AUTHORITY:
    case PERMISSION:
      return AdRequest.ERROR_CODE_INVALID_REQUEST;
    case NETWORK_NOT_READY:
    case NETWORK:
      return AdRequest.ERROR_CODE_NETWORK_ERROR;
    case AD_NOT_READY:
    case NOT_DELIVERY_AD:
    case SHOW_TIMEOUT:
      return AdRequest.ERROR_CODE_NO_FILL;
    default:
      return AdRequest.ERROR_CODE_INTERNAL_ERROR;
  }
}
 
Example 11
Source File: InMobiAdapter.java    From googleads-mobile-android-mediation with Apache License 2.0 6 votes vote down vote up
/**
 * Converts a {@link com.inmobi.ads.InMobiAdRequestStatus.StatusCode} to Google Mobile Ads SDK
 * readable error code.
 *
 * @param statusCode the {@link com.inmobi.ads.InMobiAdRequestStatus.StatusCode} to be converted.
 * @return an {@link AdRequest} error code.
 */
private static int getAdRequestErrorCode(InMobiAdRequestStatus.StatusCode statusCode) {
  switch (statusCode) {
    case INTERNAL_ERROR:
      return AdRequest.ERROR_CODE_INTERNAL_ERROR;
    case AD_ACTIVE:
    case REQUEST_INVALID:
    case REQUEST_PENDING:
    case EARLY_REFRESH_REQUEST:
    case MISSING_REQUIRED_DEPENDENCIES:
      return AdRequest.ERROR_CODE_INVALID_REQUEST;
    case REQUEST_TIMED_OUT:
    case NETWORK_UNREACHABLE:
      return AdRequest.ERROR_CODE_NETWORK_ERROR;
    case NO_FILL:
    case SERVER_ERROR:
    case AD_NO_LONGER_AVAILABLE:
    case NO_ERROR:
    default:
      return AdRequest.ERROR_CODE_NO_FILL;
  }
}
 
Example 12
Source File: AdUtils.java    From android-gradle-java-app-template with Apache License 2.0 6 votes vote down vote up
@NonNull
public static String getErrorReason(@IntRange(from = AdRequest.ERROR_CODE_INTERNAL_ERROR,
        to = AdRequest.ERROR_CODE_NO_FILL) int errorCode) {
    switch (errorCode) {
        default:
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
            return "Internal Error";

        case AdRequest.ERROR_CODE_INVALID_REQUEST:
            return "Invalid Request";

        case AdRequest.ERROR_CODE_NETWORK_ERROR:
            return "Network Error";

        case AdRequest.ERROR_CODE_NO_FILL:
            return "No Fill";
    }
}
 
Example 13
Source File: RNAdMobRewardedVideoAdModule.java    From react-native-admob with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@Override
public void onRewardedVideoAdFailedToLoad(int errorCode) {
    String errorString = "ERROR_UNKNOWN";
    String errorMessage = "Unknown error";
    switch (errorCode) {
        case AdRequest.ERROR_CODE_INTERNAL_ERROR:
          errorString = "ERROR_CODE_INTERNAL_ERROR";
          errorMessage = "Internal error, an invalid response was received from the ad server.";
          break;
        case AdRequest.ERROR_CODE_INVALID_REQUEST:
          errorString = "ERROR_CODE_INVALID_REQUEST";
          errorMessage = "Invalid ad request, possibly an incorrect ad unit ID was given.";
          break;
        case AdRequest.ERROR_CODE_NETWORK_ERROR:
          errorString = "ERROR_CODE_NETWORK_ERROR";
          errorMessage = "The ad request was unsuccessful due to network connectivity.";
          break;
        case AdRequest.ERROR_CODE_NO_FILL:
          errorString = "ERROR_CODE_NO_FILL";
          errorMessage = "The ad request was successful, but no ad was returned due to lack of ad inventory.";
          break;
    }
    WritableMap event = Arguments.createMap();
    WritableMap error = Arguments.createMap();
    event.putString("message", errorMessage);
    sendEvent(EVENT_AD_FAILED_TO_LOAD, event);
    if (mRequestAdPromise != null) {
      mRequestAdPromise.reject(errorString, errorMessage);
      mRequestAdPromise = null;
    }
}
 
Example 14
Source File: AdMobPlugin.java    From cordova-admob-pro with MIT License 6 votes vote down vote up
/** Gets a string error reason from an error code. */
public String getErrorReason(int errorCode) {
  String errorReason = "";
  switch(errorCode) {
    case AdRequest.ERROR_CODE_INTERNAL_ERROR:
      errorReason = "Internal error";
      break;
    case AdRequest.ERROR_CODE_INVALID_REQUEST:
      errorReason = "Invalid request";
      break;
    case AdRequest.ERROR_CODE_NETWORK_ERROR:
      errorReason = "Network Error";
      break;
    case AdRequest.ERROR_CODE_NO_FILL:
      errorReason = "No fill";
      break;
  }
  return errorReason;
}
 
Example 15
Source File: AdMobListener.java    From ANEAdMob with Apache License 2.0 6 votes vote down vote up
@Override
public void onAdFailedToLoad(int errorCode)
{
  String errorReason = "";
  switch(errorCode)
  {
    case AdRequest.ERROR_CODE_INTERNAL_ERROR:
      errorReason = "Internal error";
      break;
    case AdRequest.ERROR_CODE_INVALID_REQUEST:
      errorReason = "Invalid request";
      break;
    case AdRequest.ERROR_CODE_NETWORK_ERROR:
      errorReason = "Network Error";
      break;
    case AdRequest.ERROR_CODE_NO_FILL:
      errorReason = "No fill";
      break;
  }
 
  if(_who == "BANNER")
 	 _ctx.dispatchStatusEventAsync(_who+"_SHOW_FAIL", errorReason);
  else
 	 _ctx.dispatchStatusEventAsync(_who+"_CACHE_FAIL", errorReason);
}