0

我们的应用程序通过中介平台 Mopub 使用Facebook 原生广告,效果很好,但我们应该转移到另一个平台。

我已经替换了 SDK 平台,使用相同的placementId 和 app_id 并以开发者身份测试了我的应用程序。在真实广告的测试模式下一切正常,但我无法在真实设备上获得广告。

我尝试在没有任何中介平台的情况下实现 Facebook Native(底部的代码),但仍然有相同的结果。

所以问题不在于合作伙伴平台,但我无法在真实设备上获得广告。Facebook Native 抛出错误:1001 no fill

它看起来很奇怪,因为我有:

  • 应用程序有真实用户并在以前的版本中显示广告。
  • PlayMarket 中的应用程序(但使用以前的实现)具有相同的包 ID、placementId 和 app_id。
  • Facebook 已经检查了我的应用程序。
  • 我可以看到来自新版本和以前版本的请求。

代码和日志:AndroidManifest: //...

//...
     <meta-data
        android:name="com.facebook.sdk.ApplicationId"
        android:value="@string/app_id" />

应用程序 build.gradle:

//...
ext {
    supportLibraryVersion = '25.3.1'
    playServicesVersion = '11.0.1'
    FBVersion = "4.25.0"
}

dependencies {
    compile project(':library')
    compile fileTree(include: ['*.jar'], dir: 'libs')
//...
    compile "com.facebook.android:audience-network-sdk:$FBVersion"
//...
}

FacebookNativeLoader.java:

//...
    /**
     * Initiate ad container for native ad
     */
    Override
    public View createContentView(Context context) {
        log(" createContentView");
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        return inflater.inflate(R.layout.facebook_ad_native_view, null);
    }


    @Override
    public void loadAd(final MyViewManager myViewManager, final ResultListener resultListener) {
        log(" loadAd");
        adNativeLayout = myViewManager.getContentView();

        // Create ad request with Facebook ad PlacementId
        adNative = new NativeAd(myViewManager.getContext(), adPlacementId);

        //
        adNative.setAdListener(new AdListener() {
            @Override
            public void onError(Ad ad, AdError adError) {
                log("FacebookNative Ad Loading Failed." + 
                        "Error:" + NATIVE_LOAD_ERROR + 
                            "  ErrorCode:" + adError.getErrorCode() + 
                                " ErrorMessage" + adError.getErrorMessage());

                //Call Error to hide ad layout
                resultListener.onError(NATIVE_LOAD_ERROR);
            }

            @Override
            public void onAdLoaded(Ad ad) {
                log("FacebookNative Ad Loading Completed");

//...

                // Download icon for native ad
                if (adNative.getAdIcon() != null) {
                    String iconUrl = adNative.getAdIcon().getUrl();
                    if (iconUrl != null && iconUrl.length() > 0) 
                        NativeAd.downloadAndDisplayImage(adNative.getAdIcon(), icon);
                }

                // Download cover for native ad
                if (adNative.getAdCoverImage() != null) {
                    String coverUrl = adNative.getAdCoverImage().getUrl();
                    if (coverUrl != null && coverUrl.length() > 0) 
                        NativeAd.downloadAndDisplayImage(adNative.getAdCoverImage(), contentImage);
                }

                //Show debug info
                log("adNative.getCalltoAction() - " + adNative.getAdCallToAction());
                log("adNative.getBody() - " + adNative.getAdBody());
                log("adNative.getClickUrl() - " + adNative.getAdCallToAction());


                BaseLockScreenManager.url = adNative.getAdCallToAction();
                title.setText(adNative.getAdTitle());
                text.setText(adNative.getAdSubtitle());
                downloadButton.setText(adNative.getAdCallToAction());

                // Add the AdChoices icon
                LinearLayout adChoicesContainer = (LinearLayout) adNativeLayout.findViewById(R.id.ad_choices_container);
                AdChoicesView adChoicesView = new AdChoicesView(myViewManager.getContext(), adNative, true);
                adChoicesContainer.addView(adChoicesView);

                //Call Success to show ads
                resultListener.onSuccess(true);
            }

            @Override
            public void onAdClicked(Ad ad) {
                //Do something
            }

            @Override
            public void onLoggingImpression(Ad ad) {
                //Do something
            }
        });

        //Register Ad container to catch user Interactions
        adNative.registerViewForInteraction(adNativeLayout);

        // Initiate a request to load an ad.
        // Loading Ad started here...
        adNative.loadAd();
    }

在 Facebook 文档中“error: 1001 no fill”的意思是:

这是测试时常见的错误,与“No Fill”响应有关;最常见的原因是用户在测试您的移动应用程序时没有登录 Facebook 应用程序,或者在测试您的移动网站时没有登录到 Facebook 移动网站。

错误 1001 - 无填充。可能是由于以下一项或多项原因: - 用户未在移动设备上登录本机 Facebook 应用程序(但真实设备已登录本机 Facebook 应用程序)

  • 限制广告跟踪已开启 (iOS)(但这与 Android 应用无关)
  • 选择退出基于兴趣的广告(Android)(但我已关闭价值)
  • 当前用户没有广告资源(这是什么意思?)
  • 您的测试设备必须安装本机 Facebook 应用程序。(但我在真实设备上使用真实 Facebook 帐户进行了测试)
  • 您的应用程序应在 30 秒后尝试发出另一个请求。(但我每次都有相同的结果)

LogCat 消息:

开发者设备:

FacebookLoader:
    I/----FacebookLoader:  loadAd
    I/----FacebookLoader:  createContentView
    I/----FacebookLoader: Facebooknative Ad Loading Completed
    I/----FacebookLoader: adNative.getCalltoAction() - Learn More
    I/----FacebookLoader: adNative.getBody() - LAToken aims to tokenize assets worth $1.2 trillion by 2025.
    I/----FacebookLoader: adNative.getClickUrl() - Learn More

用户设备:

FacebookLoader:
    I/----FacebookLoader:  loadAd
    I/----FacebookLoader:  createContentView
    I/----FacebookLoader: FacebookNative Ad Loading Failed.Error:669  ErrorCode:1001 ErrorMessage: No fill

它有什么问题?有人有同样的问题吗?

我害怕在无法确保用户可以看到广告的情况下发布,因为我们应用程序的主要思想是广告。

4

1 回答 1

0

第 1 步:转到 Play 商店下载本机 Facebook 应用程序安装和登录
第 2 步:然后测试您的应用程序“测试添加加载成功”

其他错误,例如:“ FacebookAdapter:没有fillI / TAG:没有fill.I / Ads:广告加载失败:3 ”然后:转到清单文件并添加到应用程序级别:android:usesCleartextTraffic =“true”

 <application     
    .........  
    android:usesCleartextTraffic="true"
    .......
   />
于 2022-01-01T05:32:46.287 回答