javaandroidandroid-studioadmobinterstitial

How to open an activity when an Ad is on frequency capping


I use Google AdMob. I have some buttons and when you click on there is an interstitial ad that is opening. The problem is that I set in the Google AdMob console a limitation (1 pub every 3 minutes) and in the code, I don't know how to handle this. Will the Ad load even if the user has already clicked on the button before 3 minutes passed? Or the ad will not load and call onAdFailedToLoad() and so I call my Intent in this method?

Actually, I put my Intent in onAdClosed(), which permits the user to open activity when he clicks on the close ad. But if he clicks again in the buttons before 3 minutes passed? I can't actually try because google mentioned that you must use TestAd while testing your application.

Edit:

So I discovered that the ad don't load when the frequency cap is reached. But I don't know how to handle this in my code because I set a frequency of 1 Ad every 3 minutes. So the Ad need to load every 3 minutes.


Solution

  • So I put this following code :

     if (mInterstitialAd.isLoaded()) {
                mInterstitialAd.show();
            } else {
                //reload ad
                mInterstitialAd.loadAd(new AdRequest.Builder().build());
                Intent intent ....
    
    }
    

    Each time the user click on button the ad will try to load.