AdManagerInterstitialAd

abstract class AdManagerInterstitialAd : InterstitialAd


Google Ad Manager 게시자의 경우 페이지 변경, 앱 실행 또는 게임 레벨 로드와 같은 자연스러운 페이지 전환 시점에 전체 페이지로 게재되는 광고입니다. 전면 광고는 사용자 환경에서 광고를 없애는 닫기 버튼을 사용합니다.

샘플 코드

public class MyActivity extends Activity {
    private AdManagerInterstitialAd adManagerInterstitialAd;
    private Button nextLevelButton;
    private TextView textView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Create a full screen content callback.
        FullScreenContentCallback fullScreenContentCallback = new FullScreenContentCallback() {
            @Override
            public void onAdDismissedFullScreenContent() {
               adManagerInterstitialAd = null;
               // Proceed to the next level.
               goToNextLevel();
            }
        };

        // Load a Google Ad Manager interstitial ad. When a natural transition in the app occurs
        // (such as a level ending in a game), show the interstitial. In this simple example, the
        // press of a button is used instead.
        //
        // If the button is clicked before the interstitial is loaded, the user should proceed to
        // the next part of the app (in this case, the next level).
        //
        // If the interstitial is finished loading, the user will view the interstitial before
        // proceeding.
        AdManagerInterstitialAd.load(
            this,
            "myAdUnitId",
            new AdManagerAdRequest.Builder().build(),
            new AdManagerInterstitialAdLoadCallback() {
                @Override
                public void onAdLoaded(@NonNull AdManagerInterstitialAd ad) {
                    adManagerInterstitialAd = ad;
                    adManagerInterstitialAd.setFullScreenContentCallback(
                        fullScreenContentCallback);
                }

                @Override
                public void onAdFailedToLoad(@NonNull LoadAdError adError) {
                    // Code to be executed when an ad request fails.
                }
            });

        // Create the button to go to the next level.
        nextLevelButton = new Button(this);
        nextLevelButton.setText("Next Level");
        nextLevelButton.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                // Show the interstitial if it is ready. Otherwise, proceed to the next level
                // without ever showing it.
                if (adManagerInterstitialAd != null) {
                    adManagerInterstitialAd.show(MyActivity.this);
                } else {
                    // Proceed to the next level.
                    goToNextLevel();
                }
            }
        });

        // Add the next level button to the layout.
        LinearLayout layout = new LinearLayout(this);
        layout.setOrientation(LinearLayout.VERTICAL);
        layout.addView(nextLevelButton);

        // Create a TextView to display the current level.
        textView = new TextView(this);
        textView.setText("Level 1");
        layout.addView(textView);

        setContentView(layout);
    }

    public void goToNextLevel() {
        // Show the next level, and disable the next level button since there are no more levels.
        nextLevelButton.setEnabled(false);
        textView.setText("Level 2");
    }
}

요약

공개 생성자

공개 함수

abstract AppEventListener?

이 AdManagerInterstitialAd의 AppEventListener를 반환합니다.

java-static Unit
load(
    context: Context,
    adUnitId: String,
    adManagerAdRequest: AdManagerAdRequest,
    loadCallback: AdManagerInterstitialAdLoadCallback
)

AdManagerInterstitialAd를 로드합니다.

abstract Unit

이 AdManagerInterstitialAd의 AppEventListener를 설정합니다.

상속된 함수

com.google.android.gms.ads.interstitial.InterstitialAd에서
abstract String

광고 단위 ID를 반환합니다.

abstract FullScreenContentCallback?

이 InterstitialAd의 FullScreenContentCallback를 가져옵니다.

abstract OnPaidEventListener?

이 InterstitialAd의 OnPaidEventListener를 가져옵니다.

abstract Long

이 InterstitialAd의 게재위치 ID를 반환합니다.

abstract ResponseInfo

로드된 광고의 ResponseInfo 객체를 반환합니다.

java-static Boolean
isAdAvailable(context: Context, adUnitId: String)

이 함수는 지원 중단되었습니다.

대신 isAdAvailable를 사용하세요.

java-static Unit
load(
    context: Context,
    adUnitId: String,
    adRequest: AdRequest,
    loadCallback: InterstitialAdLoadCallback
)

InterstitialAd를 로드합니다.

java-static InterstitialAd?
pollAd(context: Context, adUnitId: String)

이 함수는 지원 중단되었습니다.

대신 pollAd를 사용하세요.

abstract Unit
setFullScreenContentCallback(
    fullScreenContentCallback: FullScreenContentCallback?
)

광고가 표시되고 전체 화면 콘텐츠가 닫힐 때 호출되는 콜백을 등록합니다.

abstract Unit
setImmersiveMode(immersiveModeEnabled: Boolean)

이 전면 광고 객체가 몰입형 모드로 표시되는지 여부를 제어하는 플래그를 설정합니다.

abstract Unit

이 광고로 수익이 발생한 것으로 추정될 때 호출되는 콜백을 등록합니다.

abstract Unit
setPlacementId(placementId: Long)

전면 광고의 게재위치 ID를 설정합니다.

abstract Unit
show(activity: Activity)

전면 광고를 표시합니다.

공개 생성자

AdManagerInterstitialAd

AdManagerInterstitialAd()

공개 함수

getAppEventListener

abstract fun getAppEventListener(): AppEventListener?

이 AdManagerInterstitialAd의 AppEventListener를 반환합니다.

load

java-static fun load(
    context: Context,
    adUnitId: String,
    adManagerAdRequest: AdManagerAdRequest,
    loadCallback: AdManagerInterstitialAdLoadCallback
): Unit

AdManagerInterstitialAd를 로드합니다.

매개변수
context: Context

컨텍스트입니다.

adUnitId: String

광고 단위 ID입니다.

adManagerAdRequest: AdManagerAdRequest

타겟팅 정보가 포함된 광고 요청입니다.

loadCallback: AdManagerInterstitialAdLoadCallback

Google Ad Manager 전면 광고가 로드를 완료할 때 호출되는 콜백입니다.

setAppEventListener

abstract fun setAppEventListener(appEventListener: AppEventListener?): Unit

이 AdManagerInterstitialAd의 AppEventListener를 설정합니다.