Jump to content
  • Advertisement
Sign in to follow this  

Prevent Ad from triggering multiple times

This topic is 968 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, I need your help plz.


When I run this code on a real device the ad-banner pops up endless times. How should I modifiy this code to run it just once? This code is from a game. Every time the player gets hit by something he loses 1 shield.


private void showBanner() {

adView.loadAd(new AdRequest.Builder()

if (player.getShieldStrength() == 0){
runOnUiThread(new Runnable() {
public void run() {


This my logcat:

Aborting last ad request since another ad request is already in progress.
The current request object will still be cached for future refreshes.

Share this post

Link to post
Share on other sites

Can you not use a flag such as (I am not too familiar with Java)

if(player.getShieldStrength() == 0 && asView.getVisibility() != View.VISIBLE)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!