当前位置: 首页>>代码示例>>Java>>正文


Java AdError类代码示例

本文整理汇总了Java中com.facebook.ads.AdError的典型用法代码示例。如果您正苦于以下问题:Java AdError类的具体用法?Java AdError怎么用?Java AdError使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AdError类属于com.facebook.ads包,在下文中一共展示了AdError类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(final Ad ad, final AdError adError) {
    if (adError == null) {
        this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNSPECIFIED);
    } else {
        switch (adError.getErrorCode()) {
            case AdError.NO_FILL_ERROR_CODE:
                this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_NO_FILL);
                break;

            case AdError.NETWORK_ERROR_CODE:
                this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.CONNECTION_ERROR);
                break;

            case AdError.SERVER_ERROR_CODE:
                this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.SERVER_ERROR_RESPONSE_CODE);
                break;

            default:
                this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.UNEXPECTED_RESPONSE_CODE);
                break;
        }
    }
}
 
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:25,代码来源:FacebookNativeAd.java

示例2: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError adError) {

    String errorString = DEFAULT_ERROR;
    if (adError != null) {
        errorString = adError.getErrorCode() + " - " + adError.getErrorMessage();
    }
    if (adError == null) {
        invokeLoadFail(new Exception(errorString));
    } else {

        switch (adError.getErrorCode()) {
            case AdError.NO_FILL_ERROR_CODE:
            case AdError.LOAD_TOO_FREQUENTLY_ERROR_CODE:
            case Facebook.ERROR_NO_FILL_1203:
                invokeLoadFail(new Exception("Facebook error: no-fill"));
                break;
            default:
                invokeLoadFail(new Exception(errorString));
                break;
        }
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:24,代码来源:FacebookNetworkAdapter.java

示例3: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError adError) {

    String errorString = DEFAULT_ERROR;
    if (adError != null) {
        errorString = adError.getErrorCode() + " - " + adError.getErrorMessage();
    }
    if (adError == null) {
        invokeLoadFail(new Exception(errorString));
    } else {

        switch (adError.getErrorCode()) {
            case AdError.NO_FILL_ERROR_CODE:
            case AdError.LOAD_TOO_FREQUENTLY_ERROR_CODE:
            case Facebook.ERROR_NO_FILL_1203:
                invokeLoadFinish(null);
                break;
            default:
                invokeLoadFail(new Exception(errorString));
                break;
        }
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:24,代码来源:FacebookNetworkAdapter.java

示例4: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(final Ad ad, final AdError adError) {
    ANLog.e("FacebookAdNetwork#onError");
    if (adError == null) {
        ANLog.e("FacebookAdNetwork: " + ErrorCode.UNSPECIFIED);
        mCustomEventListener.onNativeAdFailed(ErrorCode.UNSPECIFIED);
    } else if (adError.getErrorCode() == AdError.NO_FILL.getErrorCode()) {
        ANLog.e("FacebookAdNetwork: " + ErrorCode.NETWORK_NO_FILL);
        mCustomEventListener.onNativeAdFailed(ErrorCode.NETWORK_NO_FILL);
    } else if (adError.getErrorCode() == AdError.INTERNAL_ERROR.getErrorCode()) {
        ANLog.e("FacebookAdNetwork: " + ErrorCode.NETWORK_INVALID_STATE + " : " +
                AdError.INTERNAL_ERROR.getErrorCode());
        mCustomEventListener.onNativeAdFailed(ErrorCode.NETWORK_INVALID_STATE);
    } else {
        ANLog.e("FacebookAdNetwork: " + adError.getErrorMessage());
        mCustomEventListener.onNativeAdFailed(ErrorCode.UNSPECIFIED);
    }
}
 
开发者ID:picatcha,项目名称:adsnative-sdk-android,代码行数:19,代码来源:FacebookAdNetwork.java

示例5: convertErrorCode

import com.facebook.ads.AdError; //导入依赖的package包/类
/**
 * Converts an {@link AdError} code to Google Mobile Ads SDK readable error code.
 *
 * @param adError the {@link AdError} to be converted.
 * @return an {@link AdRequest} error code.
 */
private int convertErrorCode(AdError adError) {
    if (adError == null) {
        return AdRequest.ERROR_CODE_INTERNAL_ERROR;
    }
    int errorCode = adError.getErrorCode();
    switch (errorCode) {
        case AdError.NETWORK_ERROR_CODE:
        case AdError.SERVER_ERROR_CODE:
            return AdRequest.ERROR_CODE_NETWORK_ERROR;
        case AdError.NO_FILL_ERROR_CODE:
            return AdRequest.ERROR_CODE_NO_FILL;
        case AdError.LOAD_TOO_FREQUENTLY_ERROR_CODE:
            return AdRequest.ERROR_CODE_INVALID_REQUEST;
        case AdError.INTERNAL_ERROR_CODE:
        default:
            return AdRequest.ERROR_CODE_INTERNAL_ERROR;
    }
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:25,代码来源:FacebookAdapter.java

示例6: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:appnexus,项目名称:mobile-sdk-android,代码行数:22,代码来源:FacebookListener.java

示例7: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError adError) {
    String errorString = DEFAULT_ERROR;
    if (adError != null) {
        errorString = adError.getErrorCode() + " - " + adError.getErrorMessage();
    }
    invokeLoadFail(new Exception(errorString));
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:9,代码来源:FacebookNetworkInterstitialAdapter.java

示例8: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@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;
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:11,代码来源:BannerView.java

示例9: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError adError) {
    String errorMessage = adError.getErrorMessage();
    if (!TextUtils.isEmpty(errorMessage)) {
        Log.w(TAG, errorMessage);
    }
    FacebookAdapter.this.mBannerListener.onAdFailedToLoad(
            FacebookAdapter.this, convertErrorCode(adError));
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:10,代码来源:FacebookAdapter.java

示例10: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError error) {
    if (ad == adViewRectangle) {
        setLabel("Ad failed to load: " + error.getErrorMessage());
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:7,代码来源:RectangleFragment.java

示例11: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError error) {
    if (ad == adViewBanner) {
        setLabel("Ad failed to load: " + error.getErrorMessage());
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:7,代码来源:BannerFragment.java

示例12: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError error) {
    if (ad == interstitialAd) {
        setLabel("Interstitial ad failed to load: " + error.getErrorMessage());
    }
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:7,代码来源:InterstitialFragment.java

示例13: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError error) {
    nativeAdStatus.setText("Ad failed to load: " + error.getErrorMessage());
}
 
开发者ID:ecaroff,项目名称:sekai,代码行数:5,代码来源:NativeAdSampleActivity.java

示例14: onAdError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onAdError(AdError error) {
    Toast.makeText(this, "Ad error: " + error.getErrorMessage(), Toast.LENGTH_SHORT).show();
}
 
开发者ID:ecaroff,项目名称:sekai,代码行数:5,代码来源:NativeAdHscrollActivity.java

示例15: onError

import com.facebook.ads.AdError; //导入依赖的package包/类
@Override
public void onError(Ad ad, AdError error) {
    if (ad == rectangleAdView) {
        setLabel("Ad failed to load: " + error.getErrorMessage());
    }
}
 
开发者ID:ecaroff,项目名称:sekai,代码行数:7,代码来源:RectangleFragment.java


注:本文中的com.facebook.ads.AdError类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。