Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

load ad from admob in advance

Tags:

android

admob

I have been searching for an answer now for nearly one hour but cant find the answer to what in my mind should be a really simple task.

Is there anyway to request an ad from admob in advance, so that it is possible to show it without any delay. In my case it would mean that the ad is downloaded when the user is playing my game, and when the user loses and the "game over"-screen is displayed, the ad is already downloaded and ready to be displayed immediately.

like image 897
micke s Avatar asked Dec 04 '25 01:12

micke s


1 Answers

why don't you put this in the onCreate() Method or where your game is played:

AdView adView = new AdView(this, AdSize.BANNER, "ID");
adView .loadAd(new AdRequest());

and this in your "game over"-screen:

layoutAd.addView(adView);
like image 88
Jack Avatar answered Dec 06 '25 14:12

Jack