Search code examples
javaandroidadmobinterstitial

how I can show interstitial ads with a random presentation


hello I want to show interstitial ads with a random click on button example if I click on wallpaper 3 times the interstitial ads is showing up I want to add a function to showing Interstitial randomly after click, between 3 to 10 click

this my code :

if (Config.Counter == 2){
Config.Counter = 0;
new InterstitialAdMobModel(activity);
}else{
Config.Counter ++;
}

Solution

  •                 if (Config.Counter >= random ){
    
                        Random rand = new Random();
                        random = rand.nextInt((max - min + 1) + min);
                        new  InterstitialAdMobModel(activity);
                        Config.Counter = 0;
                    }else{
                        Config.Counter ++;
    
                    }