Ejemplo n.º 1
0
 private void removeInterstitialAd() {
   if (interstitialAd != null) {
     interstitialAd.setAdListener(null);
     interstitialAd.destroy();
     interstitialAd = null;
   }
 }
Ejemplo n.º 2
0
 private void showInterstitialAd(final String adId) {
   removeInterstitialAd();
   interstitialAd = new InterstitialAd(context);
   interstitialAd.setPublisherId(appId);
   interstitialAd.setAdListener(this);
   interstitialAd.loadAd(new AdRequest());
 }
Ejemplo n.º 3
0
 @Override
 public void onReceiveAd() {
   Log.d("PunchBoxAd", "AdHandler.onReceiveAd");
   if (adType.compareToIgnoreCase("moregame") == 0 && moreGameAd != null) {
     try {
       moreGameAd.showFloatView(context, 1.0, adId);
     } catch (PBException e) {
       e.printStackTrace();
     }
   } else if (adType.compareToIgnoreCase("interstitial") == 0 && interstitialAd != null) {
     try {
       interstitialAd.showFloatView(context, 1.0, adId);
     } catch (PBException e) {
       e.printStackTrace();
     }
   }
   listener.onReceiveAd();
 }