i added banner ads from admob to my game and the banner add appears only after the first refresh (30 seconds) . And for the first 30 seconds it's there and if you click the bottom of the page where the addvertisment should be it takes you to the advertising page but the ad is not visible.
You can see for yourself when you start the game and click bottom of the screen.
Game #1
And my other game (if you start the intent from the menu in this game ( like facebook) and then return to the menu, ads appear instantly):
Game #2
Anyone had this happen ? What can i do to fix this ?
How I initialize my ads :
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout layout = new RelativeLayout(this);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
opener = new AndroidGalleryOpener(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
View gameView = initializeForView(new Zaidimas(opener), config);
AdView adView = new AdView(this);
adView.setAdUnitId("xxxxx my secret number xxxxxxxx");
adView.setAdSize(AdSize.BANNER);
adView.loadAd(new AdRequest.Builder()
.build());
layout.addView(gameView);
RelativeLayout.LayoutParams adParams =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
adParams.addRule(RelativeLayout.CENTER_HORIZONTAL);
layout.addView(adView, adParams);
setContentView(layout);
//initialize(new Zaidimas(opener), config);
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…