Facebook 受众网络 returns 错误 "Ad was re-loaded too frequently"

Facebook Audience Network returns error "Ad was re-loaded too frequently"

我尝试将 Facebook 横幅添加到我的 Android 应用程序。它适用于我的 LG D-405,但 returns "Ad was re-loaded too frequently" 适用于三星 Galaxy S5。

adView = new AdView(getActivity(), "-------", AdSize.BANNER_HEIGHT_50);
        adView.setAdListener(new AdListener() {
            @Override
            public void onError(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

根据 facebook 的 documentation,广告请求频率有一定的限制,如果收到此错误,您应该等待 30 分钟再发出其他广告请求。

Code=1002 “Load Too Frequently”
Ad Requests are based on a combination of:
Device ID
Placement ID
Display Format (Banner, Interstitial, Native)
Your application should attempt to make another request after 30 minutes. We also suggest adjusting your Refresh Rate or Request Rate.

如果您使用模拟器,解决方法如下:

  1. 在 logcat 中搜索 AdSettings.addTestDevice。你会发现类似 "AdSettings.addTestDevice("3b656c58-53ab-43a8-a0d6-d1f82abdf251");"
  2. 将此行复制到您的代码中。

大功告成。