Banner条幅广告

Vungle Banner广告目前出在beta状态,请联系客户经理来确保正常使用Banner广告。SDK 6.5及以上才支持Banner广告。Banner采用移动广告行业的标准样式,支持320x50,300x50和728x90 (平板电脑)。

请求广告


  // Load Ad Implementation
  if (Vungle.isInitialized()) {
      Banners.loadBanner("YOUR_MREC_PLACEMENT_REFERENCE_ID", AdConfig.AdSize.BANNER, new LoadAdCallback() {
        @Override
        public void onAdLoad(String placementReferenceId) {
            // id is placementReferenceId
        }

        @Override
        public void onError(String placementReferenceId, VungleException e) {
            // Load ad error occurred - e.getLocalizedMessage() contains error message
        }
    });
  }
  

播放广告


    private RelativeLayout container;

    ...
    if (Banners.canPlayAd("YOUR_MREC_PLACEMENT_REFERENCE_ID", AdConfig.AdSize.BANNER)) {
        VungleBanner vungleBanner = Banners.getBanner("YOUR_MREC_PLACEMENT_REFERENCE_ID", AdConfig.AdSize.BANNER, new PlayAdCallback() {
        @Override
        public void onAdStart(String id) { 
            // Ad experience started
        }

        @Override
        public void onAdEnd(String id) {
            // Ad experience ended
        }

        @Override
        public void onAdClick(String id) {
            // User clicked on ad
        }

        @Override
        public void onAdRewarded(String id) {
            // User earned reward for watching an ad
        }

        @Override
        public void onAdLeftApplication(String id) {
            // User has left app during an ad experience
        }

        @Override
        public void onError(String id, VungleException exception) { 
            // Ad failed to play
        }
        });
        container.addView(vungleBanner);
    }

  

暂停广告

vungleNativeAd.setAdVisibility(false);
  

恢复播放

vungleNativeAd.setAdVisibility(true);
  

关闭广告

vungleNativeAd.finishDisplayingAd();
Powered by Creativity Driven by Performance Sign Up Here

Questions?

Need further assistance, feel free to reach out to us, we’re here to help!

这篇文章有帮助吗?