user3599442
user3599442

Reputation: 39

Show Interstitial Admob ads after certain time?

I wanted to add an interstitial ads to show on the mainactivity after certain time interval. I search, it seems there is no reference code to do so. Appreciate your help how do I do this? Any sample code will be useful. Thanks.

Upvotes: 1

Views: 4355

Answers (2)

Obeda Al Ale
Obeda Al Ale

Reputation: 51

interstitialAd.setAdListener(new AdListener() {
    public void onAdLoaded() {
        Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() {
                MainActivity.this.interstitialAd.show();
            }
        }, 5000);
    }
});

Upvotes: 0

William
William

Reputation: 20196

  1. Just set a timer on your Activity that calls interstitial.show() when it times out.
  2. Don't do this. :-) Pushing ads at your users like this is a very poor user experience. Much better to show them an ad at a natural break point in your app.

Upvotes: 3

Related Questions