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 placementReferenceId) {

            }

            @Override
            public void onAdEnd(String placementReferenceId, boolean completed, boolean isCTAClicked) {

            }

            @Override
            public void onError(String placementReferenceId, VungleException e) {
                // Play ad error occurred - e.getLocalizedMessage() contains error message
            }
        });
        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!

这篇文章有帮助吗?