예제 #1
0
 private void removeMoreGameAd() {
   if (moreGameAd != null) {
     moreGameAd.setAdListener(null);
     moreGameAd.destroy();
     moreGameAd = null;
   }
 }
예제 #2
0
 private void showMoreGameAd(final String adId) {
   removeMoreGameAd();
   moreGameAd = new MoreGameAd(context);
   moreGameAd.setPublisherId(appId);
   moreGameAd.setAdListener(this);
   moreGameAd.loadAd(new AdRequest());
 }
예제 #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();
 }