AdMob Timing

I am able to get the ads to show.  It takes a second or two for the ad to appear - I did the preload in main.lua.

The ads load on my LevelComplete screen.  On this screen is three buttons the player can choose what they want to do.

  1. End Game

  2. Replay Level

  3. Next Level

The problem is, the player can press one of the buttons before the ad loads and so the ad is skipped.

I tried to put the ad.show() as the began phase of the button and at the end of the button function but the ad doesn’t show up at all when I do that.

I would appreciate any idea’s on how to make sure the ad has been shown or the ad has been closed before the buttons are active.

Thanks

Lori

Call ads.load() as early as possible so when you go to play the ad it is already downloaded.  Where you do this load is up to you, but I’d do it after starting a level so the next time I need an ad it is ready.

https://docs.coronalabs.com/plugin/ads-admob-v2/load.html

You probably also need to confirm the ad got loaded and if not, try again or make an appropriate decision.  Ads are tricky because they are semi-asynchronous in nature, while most of what you do in your game is synchronous.

-Ed

Call ads.load() as early as possible so when you go to play the ad it is already downloaded.  Where you do this load is up to you, but I’d do it after starting a level so the next time I need an ad it is ready.

https://docs.coronalabs.com/plugin/ads-admob-v2/load.html

You probably also need to confirm the ad got loaded and if not, try again or make an appropriate decision.  Ads are tricky because they are semi-asynchronous in nature, while most of what you do in your game is synchronous.

-Ed