我致力于整合广告。但不幸的是,当我更新sdk到6.2.0广告没有加载(没有消息出现),但在同一个代码我改变sdk到5.+,广告加载和显示
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());
android应用程序已经有了5.+sdk。但正如现在facebook所说的“将你的sdk更新到最新版本”。所以我把sdk“5.+”改成了“6.2.0”,但是什么也没有出现。当我回去,改变sdk 5+再次加载和显示广告
暂无答案!
目前还没有任何答案,快来回答吧!