Set Ad and initialization
private InterstitialAd interstitial;
private final String AD_INTERSTITIAL_UNITID = "unit-id";
public void setAdMod()
{
interstitial = new InterstitialAd(getApplicationContext());
interstitial.setAdUnitId(AD_INTERSTITIAL_UNITID);
AdRequest adRequest = new AdRequest.Builder().build();
interstitial.loadAd(adRequest);
interstitial.setAdListener(new AdListener()
{
public void onAdLoaded()
{
setAdDisplay();
}
});
}
Display ad
public void setAdDisplay()
{
if (interstitial != null && interstitial.isLoaded())
{
interstitial.show();
Log.e("Show interstitial", "true");
}
else
{
Log.e("Show interstitial", "false");
}
}
No comments:
Post a Comment