FB ads not loaded when i update FAN to 6.2.0 but ad loaded & shown on 5.+ sdk with same code

早过忘川 提交于 2021-02-07 04:15:34

问题


I works on integrating ads. But unfortunently When I update sdk to 6.2.0 Ads not loaded (No message appears) But on same code i change sdk to 5.+, Ads loaded and shown

implementation 'com.facebook.android:audience-network-sdk:6.2.0' [Not loaded]

implementation 'com.facebook.android:audience-network-sdk:5.+'   [Loaded and shown]


  
    adView = new AdView(this, MainActivity.this.getString(R.string.facebook_banner_id), AdSize.BANNER_HEIGHT_50);
            // Find the Ad Container
            LinearLayout adContainer = (LinearLayout) findViewById(R.id.banner_container);
            // Add the ad view to your activity layout
            adContainer.addView(adView);
            // Request an ad
            adView.loadAd();
            //AdUtils.showFBInterstitialads(MainActivity.this);
            AdListener adListener = new AdListener() {
                @Override
                public void onError(Ad ad, AdError adError) {
                    // Ad error callback
                    Toast.makeText(
                            MainActivity.this,
                            "Error: " + adError.getErrorMessage(),
                            Toast.LENGTH_LONG)
                            .show();
                    Log.i("Adloaded", "error" + adError.getErrorMessage());
    
                }
    
                @Override
                public void onAdLoaded(Ad ad) {
                    Log.i("Adloaded", "loaded");
                }
    
                @Override
                public void onAdClicked(Ad ad) {
                    // Ad clicked callback
                }
    
                @Override
                public void onLoggingImpression(Ad ad) {
                    // Ad impression logged callback
                }
            };
            // Request an ad
            adView.loadAd(adView.buildLoadAdConfig().withAdListener(adListener).build());

** The android app has already with 5.+ sdk. But as now facebook says to "Update your sdk to latest". So I change sdk "5.+" to "6.2.0" but Nothing to appear. When I go back and change sdk 5.+ again Ads loaded and shown**

来源:https://stackoverflow.com/questions/64962584/fb-ads-not-loaded-when-i-update-fan-to-6-2-0-but-ad-loaded-shown-on-5-sdk-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!