해당 문서는 BuzzAd Ext.point SDK의 광고 지면 타입 중 하나인, Interstitial Type 을 연동하는 문서입니다. Interstitial Type 은 기존의 지면으로 부터 자유롭게, 지면 위에 광고를 노출할 수 있습니다. Bottom sheet, Dialog 등의 방식으로 사용할 수 있습니다.


구현 편의를 위해 제공하는 형태로 커스터마이징이 제한적이기 때문에 조금 더 자유로운 구현을 원하시는 경우, Native Type 을 이용해야 합니다.

다음 과정이 완료 되었는지 확인이 필요합니다.

위의 과정 중 완료되지 않은 항목이 있다면, 이전 단계의 연동을 먼저 완료해야 합니다.


연동하기

1. 기본 설정을 적용하여 구현하기

InterstitialAdHandler 설정하기

[1] InterstitialAdHandler를 생성한 뒤, 발급받은 Unit Id 를 설정합니다. Dialog 또는 Bottomsheet을 사용할 수 있습니다. (InterstitialAdHandler.Type.Dialog, InterstitialAdHandler.Type.BottomSheet)

[2] interstitialAdHandler.show(광고가_노출될_Activity.this)를 호출하여 광고를 호출합니다.

// 예시에 적힌 "Interstitial_Unit_Id" 를 '버즈빌에서 발급한 Unit Id'로 교체해 주세요.
final InterstitialAdHandler interstitialAdHandler = new InterstitialAdHandlerFactory()
        .create("Interstitial_Unit_Id", InterstitialAdHandler.Type.Dialog);
        
interstitialAdHandler.show(MainActivity.this);



연동하기

2. 추가 설정, 기능을 적용하기

다음 항목에 대한 확인이 필요합니다.

디자인 커스터마이즈 - Interstitial Ad Config 설정

Interstitial 의 디자인을 변경할 수 있습니다. 설정된 InterstitialAdConfig는 interstitialAdHandler.show()를 호출할 때 넣어서 호출합니다. (아래의 제공 항목을 벗어나는 수정은 어렵습니다.)

[1] 공통 Config

[2] Dialog 전용

InterstitialAdConfig interstitialAdConfig = 
                new InterstitialAdConfig.Builder()
                        .topIcon(R.drawable.bz_ic_checked_circle)
                        .titleText("지금 바로 참여하고 포인트 받기")
                        .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("닫기")
                        .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);
}

여러 개의 광고 로드하기 - Bottom Sheet 전용

InterstitialAdConfig를 사용하여, Bottom Sheet 에서는 여러개의 광고를 로드할 수 있습니다.

광고 로드 결과에 대한 리스너 등록

광고가 로드에 실패한 경우에 대해 리스너를 등록할 수 있습니다.

interstitialAdHandler.show(MainActivity.this, interstitialAdConfig, new InterstitialAdHandler.OnInterstitialAdEventListener() {
            @Override
            public void onAdLoadFailed(AdError error) {
                // 로드 실패시. error를 통해 로드 실패 이유를 알 수 있음
            }

            @Override
            public void onAdLoaded() {
                // 로드 성공시
            }
        });