我不知道为什么会这样,这让我很生气。长话短说,在我通过 MoPub 使用的所有广告网络中,AdMob 似乎是唯一一个不显示广告的广告网络,声称它没有足够的空间。在 MoPub 中,我有一个手机广告单元和一个平板电脑广告单元。这是具体的日志:
02-10 09:44:44.094: I/Ads(9363): Request scenario: Online server request.
02-10 09:44:50.114: D/webviewglue(9363): nativeDestroy view: 0x678b8418
02-10 09:44:50.124: I/Ads(9363): onReceiveAd()
02-10 09:44:50.124: D/MoPub(9363): Google AdMob load succeeded. Showing ad...
02-10 09:44:50.124: D/MoPub(9363): adLoaded
02-10 09:44:50.124: D/MoPub(9363): Tracking impression for native adapter.
02-10 09:44:50.144: W/Ads(9363): Not enough space to show ad! Wants: <969, 119>, Has: <800, 1073741823>
02-10 09:44:50.144: W/Ads(9363): Not enough space to show ad! Wants: <969, 119>, Has: <800, 1073741823>
广告已加载但未显示,因为显然它需要更多空间。我只想显示横幅广告。我在 Nexus 7 上进行测试。
我使用的其他网络是 LeadBolt 和 Millennial。他们在同一个空间中很好地展示横幅广告。
我的 Java 代码用于选择要显示的广告单元(基于屏幕尺寸的手机或平板电脑):
//Advert if statement
Configuration config = getResources().getConfiguration();
if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_LARGE) {
//Tablet
mAdViewTabletLarge = (MoPubView) findViewById(R.id.LargeAdvert);
mAdViewTabletLarge.setAdUnitId("id here");
mAdViewTabletLarge.setVisibility(Application.getAdVisibiltyForEdition(this.getApplicationContext()));
mAdViewTabletLarge.loadAd();
}
else if ((config.screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) ==
Configuration.SCREENLAYOUT_SIZE_XLARGE) {
//Tablet
mAdViewTabletXLarge = (MoPubView) findViewById(R.id.LargeAdvert);
mAdViewTabletXLarge.setAdUnitId("id here");
mAdViewTabletXLarge.setVisibility(Application.getAdVisibiltyForEdition(this.getApplicationContext()));
mAdViewTabletXLarge.loadAd();
}
else {
//Phone
mAdViewPhone = (MoPubView) findViewById(R.id.LargeAdvert);
mAdViewPhone.setAdUnitId("id here");
mAdViewPhone.setVisibility(Application.getAdVisibiltyForEdition(this.getApplicationContext()));
mAdViewPhone.loadAd();
}
有人知道发生了什么吗?