com.inmobi.ads.InMobiAdRequestStatus Java Examples

The following examples show how to use com.inmobi.ads.InMobiAdRequestStatus. 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: 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 #2
Source File: InMobiRewardedCustomEvent.java    From aptoide-client-v8 with GNU General Public License v3.0 5 votes vote down vote up
@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 #3
Source File: InMobiBannerAdListener.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onAdLoadFailed(InMobiBanner inMobiBanner, InMobiAdRequestStatus inMobiAdRequestStatus) {
    Clog.e(Clog.mediationLogTag, "InMobiBanner: onAdLoadFailed" );
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdFailed(InMobiSettings.getResultCode(inMobiAdRequestStatus));
    }
}
 
Example #4
Source File: InMobiInterstitialAdListener.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onAdLoadFailed(InMobiInterstitial inMobiInterstitial, InMobiAdRequestStatus inMobiAdRequestStatus) {
    Clog.e(Clog.mediationLogTag, "InMobiInterstitial: onAdLoadFailed" );
    if (mediatedAdViewController != null) {
        mediatedAdViewController.onAdFailed(InMobiSettings.getResultCode(inMobiAdRequestStatus));
    }
}
 
Example #5
Source File: InMobiNativeAdListener.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
@Override
public void onAdLoadFailed(InMobiNative inMobiNative, InMobiAdRequestStatus inMobiAdRequestStatus) {
    Clog.e(Clog.mediationLogTag, "InMobiNative: " + inMobiAdRequestStatus.toString());
    if (controller != null) {
        controller.onAdFailed(InMobiSettings.getResultCode(inMobiAdRequestStatus));
    }
}
 
Example #6
Source File: InMobiSettings.java    From mobile-sdk-android with Apache License 2.0 5 votes vote down vote up
public static ResultCode getResultCode(InMobiAdRequestStatus status) {
    ResultCode code = ResultCode.INTERNAL_ERROR;
    switch (status.getStatusCode()) {
        case NETWORK_UNREACHABLE:
            code = ResultCode.NETWORK_ERROR;
            break;
        case NO_FILL:
            code = ResultCode.UNABLE_TO_FILL;
            break;
        case REQUEST_INVALID:
            code = ResultCode.INVALID_REQUEST;
            break;
        case REQUEST_PENDING:
            break;
        case REQUEST_TIMED_OUT:
            code = ResultCode.NETWORK_ERROR;
            break;
        case INTERNAL_ERROR:
            break;
        case SERVER_ERROR:
            code = ResultCode.UNABLE_TO_FILL;
            break;
        case AD_ACTIVE:
            code = ResultCode.INVALID_REQUEST;
            break;
        case EARLY_REFRESH_REQUEST:
            code = ResultCode.INVALID_REQUEST;
            break;
    }
    return code;
}
 
Example #7
Source File: InMobiNativeCustomEvent.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void onAdLoadFailed(final InMobiNative inMobiNative,
    final InMobiAdRequestStatus inMobiAdRequestStatus) {
  super.onAdLoadFailed(inMobiNative, inMobiAdRequestStatus);
  String errorMessage = "Failed to load Native Strand:";
  switch (inMobiAdRequestStatus.getStatusCode()) {
    case INTERNAL_ERROR:
      errorMessage += "INTERNAL_ERROR";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
      break;

    case REQUEST_INVALID:
      errorMessage += "INVALID_REQUEST";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_REQUEST);
      break;

    case NETWORK_UNREACHABLE:
      errorMessage += "NETWORK_UNREACHABLE";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
      break;

    case NO_FILL:
      errorMessage += "NO_FILL";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
      break;

    case REQUEST_PENDING:
      errorMessage += "REQUEST_PENDING";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    case REQUEST_TIMED_OUT:
      errorMessage += "REQUEST_TIMED_OUT";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_TIMEOUT);
      break;

    case SERVER_ERROR:
      errorMessage += "SERVER_ERROR";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
      break;

    case AD_ACTIVE:
      errorMessage += "AD_ACTIVE";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    case EARLY_REFRESH_REQUEST:
      errorMessage += "EARLY_REFRESH_REQUEST";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    default:
      errorMessage = "UNKNOWN_ERROR" + inMobiAdRequestStatus.getStatusCode();
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;
  }
  Log.w(TAG, errorMessage);
  STATIC_MAP.remove(this.hashCode());
  destroy();
}
 
Example #8
Source File: InMobiNativeCustomEvent.java    From aptoide-client-v8 with GNU General Public License v3.0 4 votes vote down vote up
@Override public void onAdLoadFailed(@NonNull InMobiNative InMobiNative,
    @NonNull InMobiAdRequestStatus requestStatus) {
  String errorMessage = "Failed to load Native Strand:";
  switch (requestStatus.getStatusCode()) {
    case INTERNAL_ERROR:
      errorMessage += "INTERNAL_ERROR";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
      break;

    case REQUEST_INVALID:
      errorMessage += "INVALID_REQUEST";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_REQUEST);
      break;

    case NETWORK_UNREACHABLE:
      errorMessage += "NETWORK_UNREACHABLE";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
      break;

    case NO_FILL:
      errorMessage += "NO_FILL";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
      break;

    case REQUEST_PENDING:
      errorMessage += "REQUEST_PENDING";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    case REQUEST_TIMED_OUT:
      errorMessage += "REQUEST_TIMED_OUT";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.NETWORK_TIMEOUT);
      break;

    case SERVER_ERROR:
      errorMessage += "SERVER_ERROR";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
      break;

    case AD_ACTIVE:
      errorMessage += "AD_ACTIVE";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    case EARLY_REFRESH_REQUEST:
      errorMessage += "EARLY_REFRESH_REQUEST";
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;

    default:
      errorMessage = "UNKNOWN_ERROR" + requestStatus.getStatusCode();
      mCustomEventNativeListener.onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
      break;
  }
  Log.w(TAG, errorMessage);
  STATIC_MAP.remove(this.hashCode());
  destroy();
}