Interstitial Type (2.0)

BuzzAd Benefit SDK: Interstitial Ads


This documentation provides a guideline for integrating interstitial ads for BuzzAd Benefit.

※ Note

  1. Please proceed with the following process only after BuzzAd Benefit SDK integration is complete.

  2. The interstitial type is available for the convenience of app publishers. For more customization options, please implement the native type.

 

Index

 

Basic Usage


Setting the InterstitialAdHandler

  1. Create the InterstitialAdHandler with unit_id and type (Dialog or Bottomsheet, see below for details).

  2. Request for ads by calling interstitialAdHandler.show(Context)


    final InterstitialAdHandler interstitialAdHandler = new InterstitialAdHandlerFactory() .create("YOUR_INTERSTITIAL_UNIT_ID", InterstitialAdHandler.Type.Dialog); interstitialAdHandler.show(MainActivity.this);

Setting the Interstitial Type

Please set the desired type of interstitial ad either by Dialog or BottomSheet :

  • InterstitialAdHandler.Type.Dialog

  • InterstitialAdHandler.Type.BottomSheet

 

 

Advanced Usage


Setting the InterstitialAdConfig

The design and the number of advertisement are configurable with the InterstitialAdConfig. To apply the customized configuration, pass it to the handler when calling interstitialAdHandler.show().

Common Config

  • topIcon : Icon at the top of the Interstitial ad (can be specified with drawable id or drawable type)

  • titleText : Text at the top of the Interstitial ad

  • textColor : Color of titleText

  • layoutBackgroundColor : Background color of the interstitial ad

  • ctaViewBackgroundColorList : Background color of CTA view

  • ctaRewardDrawable : Default icon included in CTA view (can be specified with drawable id or drawable type)

  • ctaParticipatedDrawable : Icon included in CTA view upon conversion (can be specified with drawable id or drawable type)

  • ctaViewTextColor : Color of the text in CTA view

Dialog Specific Config

  • closeText : Text for close button

Bottom Sheet Specific Config

  • adCount : 1 ~ 5 ads can be requested at one time. adCount is fixed to 5 if is not set or set beyond 5.

 

InterstitialAdConfig interstitialAdConfig = new InterstitialAdConfig.Builder() .topIcon(R.drawable.bz_ic_checked_circle) .titleText("View now and earn points") .textColor(android.R.color.white) .layoutBackgroundColor(R.color.colorPrimaryDark) .ctaViewBackgroundColorList(getBackgroundColorStateList()) .ctaRewardDrawable(R.drawable.bz_ic_custom_reward) .ctaParticipatedDrawable(R.drawable.bz_ic_btn_more) .ctaViewTextColor(getTextColorStateList()) .closeText("close") .build(); final InterstitialAdHandler interstitialAdHandler = new InterstitialAdHandlerFactory() .create("YOUR_INTERSTITIAL_UNIT_ID", InterstitialAdHandler.Type.Dialog); interstitialAdHandler.show(MainActivity.this, interstitialAdConfig); private ColorStateList getBackgroundColorStateList() { final int[][] states = new int[][]{ new int[]{android.R.attr.state_enabled}, // enabled new int[]{android.R.attr.state_pressed} // pressed }; final int[] colors = new int[]{ ContextCompat.getColor(this, android.R.color.holo_green_light), ContextCompat.getColor(this, android.R.color.holo_green_dark) }; return new ColorStateList(states, colors); } private ColorStateList getTextColorStateList() { int[][] states = new int[][]{ new int[]{android.R.attr.state_enabled}, // enabled new int[]{android.R.attr.state_pressed} // pressed }; int[] colors = new int[]{ Color.WHITE, Color.WHITE }; return new ColorStateList(states, colors); }

Registering a listener for ad loading results

A listener can be registered in case of ad loading failures.

 

interstitialAdHandler.show(MainActivity.this, interstitialAdConfig, new InterstitialAdHandler.OnInterstitialAdEventListener() { @Override public void onAdLoadFailed(AdError error) { // on load failure, error explains why the load failed } @Override public void onAdLoaded() { // on successful load } });