i am making app with Android Studio using Wordpress as backend and fetching posts via json api .. now i want to implements AdMob interstitial ads in my app but don’t want to show ads for every post because it will violate AdMob's policy . what is want is that interstitial should show when user click RecyclerView's post for 3rd time , how can i implement that ? in short i want to show ads after 3rd click on button..
this is my button to show ad
adapter = new PostAdapter( new ArrayList<>(), new BtnClick() {
@Override
public void btnClick() {
Log.e("Inter Button Clicked", "Button CLicked");
}
});
you can have a variable int clickCount=0;
and in onClickListener
of that button use this logic
if(clickCount<3){
clickCount++;
}else{
clickCount=0;
showInterestialAd();
}