其他分享
首页 > 其他分享> > android – Facebook Audience Network返回错误“广告重新加载太频繁”

android – Facebook Audience Network返回错误“广告重新加载太频繁”

作者:互联网

我尝试将Facebook横幅添加到我的Android应用程序中.它适用于我的LG D-405,但三星Galaxy S5返回“广告重载过于频繁”.

adView = new AdView(getActivity(), "-------", AdSize.BANNER_HEIGHT_50);
        adView.setAdListener(new AdListener() {
            @Override
            public void one rror(Ad ad, AdError adError) {
                if(getActivity()!=null) {
                    ((MyApplication) getActivity().getApplication()).getDefaultTracker().send(
                            new HitBuilders.EventBuilder()
                                    .setCategory("Facebook AdView")
                                    .setAction("error")
                                    .setLabel(adError.getErrorMessage())
                                    .setValue((long) adError.getErrorCode())
                                    .build()
                    );
                }
            }

            @Override
            public void onAdLoaded(Ad ad) {
                if(!layout.getChildAt(2).equals(adView)) {
                    layout.addView(adView, 2, new LinearLayout.LayoutParams((int) (AdSize.BANNER_HEIGHT_50.getWidth() * MainActivity.density), (int) (AdSize.BANNER_HEIGHT_50.getHeight() * MainActivity.density)));
                }
            }

            @Override
            public void onAdClicked(Ad ad) {

            }
        });
        //adView.disableAutoRefresh();
        adView.loadAd();

解决方法:

我也遇到了同样的问题,似乎你必须在设备上安装Facebook应用程序并在过去30天内登录.

另外,我发现了这个 – https://developers.facebook.com/docs/audience-network/faq#a12

Source

标签:android,facebook-sdk-4-0,facebook-audience-network
来源: https://codeday.me/bug/20190623/1272213.html