Advertisement




How To Add Interstitial ads for every navigation menu drawer in latest android versions 2020

Problem :

Not able to add interstitial ad for every navigation drawer item click in latest android application ,year 2020

Solution : 

Add interstitial ad load request inside the onSupportNavigateUp method as shown below .
@Override
public boolean onSupportNavigateUp() {
AdRequest adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp();
}

Post a comment

0 Comments