Android AdMob横幅在60秒后显示
在LogCat中,我看到Android AdMob横幅在60秒后显示,android,admob,Android,Admob,在LogCat中,我看到从现在起60000毫秒内安排广告刷新。消息,然后在1分钟后,当我启动应用程序时,横幅显示出来。这是我的密码: DisplayMetrics displaymetrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(displaymetrics); int screenWidth = displaymetrics.width
从现在起60000毫秒内安排广告刷新。
消息,然后在1分钟后,当我启动应用程序时,横幅显示出来。这是我的密码:
DisplayMetrics displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
int screenWidth = displaymetrics.widthPixels;
int screenHeight = displaymetrics.heightPixels;
LinearLayout.LayoutParams adParams = new LinearLayout.LayoutParams(screenWidth, 2 * screenHeight - 75);
// Create an ad.
adView = new AdView(this);
adView.setAdSize(AdSize.BANNER);
adView.setAdUnitId(AD_UNIT_ID);
// Create an ad request. Check logcat output for the hashed device ID to
// get test ads on a physical device.
AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("INSERT_YOUR_HASHED_DEVICE_ID_HERE")
.build();
// Start loading the ad in the background.
adView.loadAd(adRequest);
// Adding full screen container
addContentView(adView, adParams);
如何在加载完成后立即显示横幅?您好,为什么不用xml声明您的adView?另外,在活动的onResume/onPause方法中是否有adView.onResume()和adView.onPause()。@Tristan hi,我不熟悉Android开发,我做CoCoCo2D-x开发。因此,我不知道在哪里创建XML文件,在eclipse中设置什么设置,以及在该XML中编写什么。因此,我们决定不使用xml。是的,我在活动的onResume/onPause方法中有adView.onResume()和adView.onPause()。但问题不在于这些方法,因为banner在应用程序启动时出现延迟。在
计划广告刷新60000毫秒之前/之后发布日志。
应该有关于广告显示的其他信息。也许最初没有广告。