• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Ad类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onError

import com.facebook.ads.Ad; //导入依赖的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.Ad; //导入依赖的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.Ad; //导入依赖的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: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(Ad ad) {
  this.removeAllViews();

  Resources r = mContext.getResources();
  DisplayMetrics dm = r.getDisplayMetrics();
  int pxW = mSize.getWidth() > 0 ?
    dp2px(mSize.getWidth(), dm)
    : r.getDisplayMetrics().widthPixels;
  int pxH = dp2px(mSize.getHeight(), dm);

  myAdView.measure(pxW, pxH);
  myAdView.layout(0, 0, pxW, pxH);

  addView(myAdView);
}
 
开发者ID:callstack,项目名称:react-native-fbads,代码行数:17,代码来源:BannerView.java


示例5: onError

import com.facebook.ads.Ad; //导入依赖的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


示例6: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(Ad ad) {
    if (ad != mNativeAd) {
        Log.w(TAG, "Ad loaded is not a native ad.");
        FacebookAdapter.this.mNativeListener.onAdFailedToLoad(
                FacebookAdapter.this, AdRequest.ERROR_CODE_INTERNAL_ERROR);
        return;
    }

    NativeAdOptions options = mMediationAdRequest.getNativeAdOptions();
    // We always convert the ad into an app install ad.
    final AppInstallMapper mapper = new AppInstallMapper(mNativeAd, options);
    mapper.mapNativeAd(new NativeAdMapperListener() {
        @Override
        public void onMappingSuccess() {
            mNativeListener.onAdLoaded(FacebookAdapter.this, mapper);
        }

        @Override
        public void onMappingFailed() {
            mNativeListener.onAdFailedToLoad(FacebookAdapter.this,
                    AdRequest.ERROR_CODE_NO_FILL);
        }
    });
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:26,代码来源:FacebookAdapter.java


示例7: onError

import com.facebook.ads.Ad; //导入依赖的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


示例8: onInterstitialDismissed

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onInterstitialDismissed(Ad ad) {
    Toast.makeText(this.getActivity(), "Interstitial Dismissed", Toast.LENGTH_SHORT).show();

    // Cleanup.
    interstitialAd.destroy();
    interstitialAd = null;
}
 
开发者ID:eviltnan,项目名称:kognitivo,代码行数:9,代码来源:InterstitialFragment.java


示例9: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(Ad ad) {
    Logger.d("FragmentSocialTimeline","onAdLoaded , ad: "+ad.toString());
    if(getActivity() != null){
        adapter.addNativeAd((NativeAd) ad,getActivity(),apks);
    }

}
 
开发者ID:Aptoide,项目名称:aptoide-client,代码行数:9,代码来源:FragmentSocialTimeline.java


示例10: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(final Ad ad) {
    // This identity check is from Facebook's Native API sample code:
    // https://developers.facebook.com/docs/audience-network/android/native-api
    if (!this.nativeAd.equals(ad) || !this.nativeAd.isAdLoaded()) {
        this.getCustomEventNativeListener().onNativeAdFailed(NativeErrorCode.NETWORK_INVALID_STATE);
        return;
    }

    this.setTitle(this.nativeAd.getAdTitle());
    this.setText(this.nativeAd.getAdBody());

    final NativeAd.Image coverImage = this.nativeAd.getAdCoverImage();
    if (coverImage != null) this.setMainImageUrl(coverImage.getUrl());

    final NativeAd.Image icon = this.nativeAd.getAdIcon();
    if (icon != null) this.setIconImageUrl(icon.getUrl());

    this.setCallToAction(this.nativeAd.getAdCallToAction());
    this.setStarRating(FacebookNativeAd.getStarRatingValue(this.nativeAd.getAdStarRating()));

    this.addExtra(FacebookNativeAd.SOCIAL_CONTEXT_FOR_AD, this.nativeAd.getAdSocialContext());

    final NativeAd.Image adChoicesIconImage = this.nativeAd.getAdChoicesIcon();
    if (adChoicesIconImage != null) {
        this.setPrivacyInformationIconImageUrl(adChoicesIconImage.getUrl());
        this.setPrivacyInformationIconClickThroughUrl(this.nativeAd.getAdChoicesLinkUrl());
    }

    this.preCacheImages(this.getImageUrls());

    this.setImpressionMinTimeViewed(BaseStaticNativeAd.IMPRESSION_MIN_TIME);
}
 
开发者ID:ayltai,项目名称:mopub-nativead-adapters,代码行数:34,代码来源:FacebookNativeAd.java


示例11: onError

import com.facebook.ads.Ad; //导入依赖的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


示例12: onAdLoaded

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

    mWrapper = new FacebookNativeAdModel(mContext, mNativeAd);
    mAdView = new PNLargeLayoutRequestView(mContext);
    mAdView.loadWithAd(mContext, mWrapper);
    invokeLoadSuccess();
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:9,代码来源:FacebookNetworkAdapter.java


示例13: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(Ad ad) {
    if (ad == mNativeAd) {
        FacebookNativeAdModel wrapModel = new FacebookNativeAdModel(mContext, (NativeAd) ad);
        wrapModel.setInsightModel(mInsight);
        invokeLoadFinish(wrapModel);
    }
}
 
开发者ID:pubnative,项目名称:pubnative-android-sdk,代码行数:9,代码来源:FacebookNetworkAdapter.java


示例14: onError

import com.facebook.ads.Ad; //导入依赖的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


示例15: onAdClicked

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdClicked(Ad ad) {
    FacebookAdapter.this.mBannerListener.onAdClicked(FacebookAdapter.this);
    FacebookAdapter.this.mBannerListener.onAdOpened(FacebookAdapter.this);
    // The test Facebook ads leave the application when the ad is clicked. Assuming all
    // the ads do the same, sending onAdLeftApplication callback when the ad is clicked.
    FacebookAdapter.this.mBannerListener.onAdLeftApplication(FacebookAdapter.this);
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:9,代码来源:FacebookAdapter.java


示例16: onError

import com.facebook.ads.Ad; //导入依赖的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


示例17: onLoggingImpression

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onLoggingImpression(Ad ad) {
    if (mIsImpressionRecorded) {
        Log.d(TAG, "Received onLoggingImpression callback for a native whose impression"
                + " is already recorded. Ignoring the duplicate callback.");
        return;
    }
    FacebookAdapter.this.mNativeListener.onAdImpression(FacebookAdapter.this);
    mIsImpressionRecorded = true;
}
 
开发者ID:googleads,项目名称:googleads-mobile-android-mediation,代码行数:11,代码来源:FacebookAdapter.java


示例18: onAdLoaded

import com.facebook.ads.Ad; //导入依赖的package包/类
@Override
public void onAdLoaded(Ad ad) {
    if (nativeAd == null || nativeAd != ad) {
        // Race condition, load() called again before last ad was displayed
        return;
    }

    // Unregister last ad
    nativeAd.unregisterView();

    nativeAdStatus.setText("");

    inflateAd(nativeAd, adView, this);
}
 
开发者ID:benbek,项目名称:HereAStory-Android,代码行数:15,代码来源:NativeAdSampleActivity.java


示例19: onError

import com.facebook.ads.Ad; //导入依赖的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


示例20: onAdLoaded

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java HttpEndpoint类代码示例发布时间:2022-05-21
下一篇:
Java Copy类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap