Why Admob Interstitial Ads showing in the middle of the game?

231 views
Skip to first unread message

muhammad iril

unread,
Mar 4, 2014, 7:03:48 PM3/4/14
to google-adm...@googlegroups.com

I just made game like ironpants, I'm trying to put interstitial ads when the game over.

but right now, when I developed this game, the interstitial ads always show in the middle of the game. I think it'll be annoying for users. 

The interstitial ads only show after 5x game over.

I think it is because I only have one screen for this game MainGameView.java. so when user dead after play the game, the ads don't have time to load, and the it will load in the middle of the game? is it againts admob TOS?

here's the code to show admob interstitial ads when the game was over.

the methods to initialize the interstitial ads


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    initialiseAccelerometer();

    // Create the interstitial
    interstitial = new InterstitialAd(this, getResources().getString(R.string.InterstitialAd_unit_id));

}

public void openAd() {
    runOnUiThread(new Runnable() {
        public void run() {
            // Create ad request
            AdRequest adRequest = new AdRequest();

            // Begin loading your interstitial
            interstitial.loadAd(adRequest);

            // Set Ad Listener to use the callbacks below
            interstitial.setAdListener(new AdListener() {

                @Override
                public void onReceiveAd(Ad arg0) {
                    if (interstitial.isReady()) {
                        interstitial.show();
                    }
                }

                @Override
                public void onPresentScreen(Ad arg0) {
                }

                @Override
                public void onLeaveApplication(Ad arg0) {
                }

                @Override
                public void onFailedToReceiveAd(Ad arg0, ErrorCode arg1) {
                }

                @Override
                public void onDismissScreen(Ad arg0) {
                }
            });
        }
    });
}



and I call openAd() method when the game was over


public synchronized void GameOver() {
    if (adounter >= this.getResources().getInteger(R.integer.add_shows_every_X_gameovers)) {
        openAd();
        adounter = 0;
    }
    adounter++;
}

can you guys give me some advice how to handle situation like this?


thank you very much and sorry for my bad English.

Amy Quispe (AdMob SDK Team)

unread,
Mar 4, 2014, 7:50:48 PM3/4/14
to google-adm...@googlegroups.com
Hi Fujitora,

Is there any reason you're not using the new Google Play Services SDK?

It's a pretty bad user experience to show interstitials in the middle of the game, but not against TOS.

You could pause the game from starting again until onDismissAd() (or onAdFailedToLoad() in case you don't get an ad)- that way you wait until the ad is closed before resuming.

Amy

Fujitora

unread,
Mar 4, 2014, 8:53:32 PM3/4/14
to google-adm...@googlegroups.com
Hi, Amy. thx for your time to answer my question.

I'm new here, I haven't explored everything yet. so I don't know about Google Play Services SDK. 

so, is it okay if I show the interstitial ads in the middle of the game? what if users accidentaly clicked the ads? since the game needs user touches on the screen .  . will admob banned my account?

it'll be very bad for me if I just tried to use admob and my account got banned. 


thank you very much and sorry for my bad English.

William Ferguson

unread,
Mar 6, 2014, 6:12:44 AM3/6/14
to google-adm...@googlegroups.com
Fujitora as I explained on StackOverflow, your problem is that you are showing the interstitial as soon as it becomes available (in AdListsner#onAdReceived).
You should instead show the ad at a natural break point in your app.

William

Amy Quispe (AdMob SDK Team)

unread,
Mar 6, 2014, 7:17:21 PM3/6/14
to google-adm...@googlegroups.com
Hi Fujitora

What William said - you should use interstitials at places like the end of levels etc.

Amy Quispe

Flester Iulian

unread,
Dec 5, 2022, 8:12:05 AM12/5/22
to Google Mobile Ads SDK Developers
Hi, I can't start a new conversation, so I will hijack this conversion

I'm trying to follow the example from the documentation available at this location:

and this part doesn't work:


new AppOpenAdLoadCallback() {
/**
* Called when an app open ad has loaded.
*
* @param ad the loaded app open ad.
*/
@Override
public void onAdLoaded(AppOpenAd ad) {
appOpenAd = ad;
isLoadingAd = false;
loadTime = (new Date()).getTime();

Log.d(LOG_TAG, "onAdLoaded.");
Toast.makeText(context, "onAdLoaded", Toast.LENGTH_SHORT).show();
}

/**
* Called when an app open ad has failed to load.
*
* @param loadAdError the error.
*/
@Override
public void onAdFailedToLoad(LoadAdError loadAdError) {
isLoadingAd = false;
Log.d(LOG_TAG, "onAdFailedToLoad: " + loadAdError.getMessage());
Toast.makeText(context, "onAdFailedToLoad", Toast.LENGTH_SHORT).show();
}
});


Cannot resolve symbol 'AppOpenAdLoadCallback'

It looks like the documentation is outdated ... why? If the official documentation doesn't work, how can I implement OpenAd in my application?

Mobile Ads SDK Forum Advisor

unread,
Dec 5, 2022, 2:25:00 PM12/5/22
to iulian....@gmail.com, google-adm...@googlegroups.com
Hi Flester,

Thank you for reporting this to us.

With regard to the Cannot resolve symbol error that you're getting occurs whenever there is an identifier in the source code which the compiler is unable to work out what it refers to. I went ahead and check our AppOpenAds sample app, but didn't encounter the issue on my end. Instead, the app builds successfully and I was able to load the ad (please see attached screenshot). With that, we would recommend to check/do the following.
  • Run build->clean
  • synced and run 'invalidate caches/restart'
We would also suggest to check our sample app as well on your end.

Regards,
Google Logo
Teejay Wennie
Mobile Ads SDK Team
 


ref:_00D1U1174p._5004Q2gigLK:ref
Screenshot 2022-12-06 at 1.29.59 AM.png
Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages