Facebook受众网络广告未展示

时间:2019-08-20 12:19:50

标签: java android facebook ads

我正在尝试集成Facebook广告,我遵循了所有文档,但无法正常工作

Manifists

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

 @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash_screen);
        AudienceNetworkAds.initialize(this);


        facebookAdView = new com.facebook.ads.AdView(this,"732965463811239_733275773780208", AdSize.BANNER_HEIGHT_50);

        LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);

        // Add the ad view to your activity layout
        adContainer.addView(facebookAdView);

        // Request an ad
        facebookAdView.loadAd();

    }

2 个答案:

答案 0 :(得分:1)

对于您的测试Facebook广告,您的横幅ID为

facebookAdView = new com.facebook.ads.AdView
(this,"IMG_16_9_APP_INSTALL#732965463811239_733275773780208, 
AdSize.BANNER_HEIGHT_50);

答案 1 :(得分:0)

我通过添加
解决了该问题  AdSettings.addTestDevice(“ 808a2024-66bb-4d52-9804-3c905991f2b3”);