Search code examples
androidloopsadmobadsinterstitial

Interstitial Ad Loading After every 1 Minte


I want to Display a Interstitial Ad after every one minute... can any one please explain with sample code ...

thanks Please

    interstitialAds = new InterstitialAd(this, "Your_Pub_ID");
    final AdRequest adRequest = new AdRequest();
    interstitialAds.loadAd(adRequest);
    interstitialAds.setAdListener(this);

Solution

  • There are numerous way to display Interstitial ads at regular interval of time. You can add codes in your app in order to display Interstitial ads at regular interval of time.


    prepareAd();

        ScheduledExecutorService scheduler =
                Executors.newSingleThreadScheduledExecutor();
        scheduler.scheduleAtFixedRate(new Runnable() {
    
            public void run() {
                Log.i("hello", "world");
                runOnUiThread(new Runnable() {
                    public void run() {
                        if (mInterstitialAd.isLoaded()) {
                            mInterstitialAd.show();
                        } else {
                           Log.d("TAG"," Interstitial not loaded");
                        }
    
                        prepareAd();
    
    
                    }
                });
    
            }
        }, 20, 20, TimeUnit.SECONDS);
    

    However, I (you can say that admob) strongly stopping you to doing such stuffs. It is against AdMob policy and your account will get suspended if you do so.

    If you want to learn more stuffs about android app development and how to place admob ad in your application. I recommend you to visit this website.

    http://www.elegantespace.com/how-to-load-interstitial-ad-at-regular-interval-of-time/