2017-05-16 237 views
1

我是Android開發新手。我有一個Web視圖應用程序。我目前的Admob插頁式廣告代碼只加載一次。任何人可以幫助我如何後網頁加載如何在網頁加載後加載Admob插頁式廣告?

 AdRequest adRequest = new AdRequest.Builder().build(); 

      // Prepare the Interstitial Ad 
      interstitial = new InterstitialAd(MainActivity.this); 
// Insert the Ad Unit ID 
      interstitial.setAdUnitId(getString(R.string.admob_interstitial_id)); 

      interstitial.loadAd(adRequest); 
// Prepare an Interstitial Ad Listener 
      interstitial.setAdListener(new AdListener() { 
       public void onAdLoaded() { 
// Call displayInterstitial() function 
        displayInterstitial(); 
       } 

       public void displayInterstitial() { 
// If Ads are loaded, show Interstitial else show nothing. 
        if (interstitial.isLoaded()) { 
         interstitial.show(); 
        } 
       } 
      }); 

回答

0

這裏設置AdMob插頁負載代碼

mWebView.setWebViewClient(new WebViewClient() { 

    @Override 
    public void onPageFinished(WebView view, String url) { 

    //web page loaded , show your interstitial 

    } 
});