In my onCreate
, I have the code:
interstitial = new InterstitialAd(this);
interstitial.setAdUnitId("ca-app-pub-1852329945819279/4025192744");
// Create ad request.
AdRequest adRequest1 = new AdRequest.Builder().build();
// Begin loading your interstitial.
interstitial.loadAd(adRequest1);
Where "interstitial" is a private InterstitialAd interstitial
.
I then display the interstitial using the following method:
public void displayInterstitial() {
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (interstitial.isLoaded()) {
interstitial.show();
}
resetInterstitial();
}
});
}
How can I display the interstitial (call the displayInterstitial()
method) as soon as the interstitial is loaded? All help appreciated.