Interstitial ads는 앱의 인터페이스를 일시적으로 가리는 전체 화면 또는 전체 페이지 광고입니다. 일반적으로 게임에서 레벨을 완료한 후나 주요 뷰 사이를 이동할 때와 같이 자연스러운 일시 중지 또는 전환 시점에 표시됩니다.
다음 섹션에서는 Interstitial ad를 로드하고 표시하는 방법을 보여줍니다.
다음 코드는 이벤트 리스너를 등록하고 첫 번째 interstitial을 로드하는 방법을 보여줍니다.
var interstitialAdUnitId:String = "«ad-unit-ID»";
var retryAttempt:Number;
public function initializeInterstitialAds():void
{
// Attach event callbacks
AppLovinMAXEvents.setInterstitialLoadedEvent(onInterstitialLoaded);
AppLovinMAXEvents.setInterstitialLoadFailedEvent(onInterstitialLoadFailed);
AppLovinMAXEvents.setInterstitialDisplayedEvent(onInterstitialDisplayed);
AppLovinMAXEvents.setInterstitialFailedToDisplayEvent(onInterstitialFailedToDisplay);
AppLovinMAXEvents.setInterstitialClickedEvent(onInterstitialClicked);
AppLovinMAXEvents.setInterstitialHiddenEvent(onInterstitialHidden);
// Load the first interstitial
loadInterstitial();
}
private function loadInterstitial()
{
AppLovinMAX.loadInterstitial(interstitialAdUnitId);
}
private function onInterstitialLoaded(adEventInfo:AdEventInfo):void
{
// Interstitial ad is ready for you to show. AppLovinMAX.isInterstitialReady(adUnitId) now returns 'true'
// Reset retry attempt
retryAttempt = 0;
}
private function onInterstitialLoadFailed(adEventInfo:AdEventInfo):void
{
// Interstitial ad failed to load
// AppLovin recommends that you retry with exponentially higher delays, up to a maximum delay (in this case 64 seconds)
retryAttempt++;
var retryDelay:Number = Math.pow(2, Math.min(6, retryAttempt));
var timer:Timer = new Timer(retryDelay * 1000, 1);
timer.addEventListener(TimerEvent.TIMER, loadInterstitial);
timer.start();
}
private function onInterstitialDisplayed(adEventInfo:AdEventInfo):void {}
private function onInterstitialFailedToDisplay(adEventInfo:AdEventInfo):void
{
// Interstitial ad failed to display. AppLovin recommends that you load the next ad.
loadInterstitial();
}
private function onInterstitialClicked(adEventInfo:AdEventInfo):void {}
private function onInterstitialHidden(adEventInfo:AdEventInfo):void
{
// Interstitial ad is hidden. Pre-load the next ad.
loadInterstitial();
}
권장 사항: Interstitial ads 표시하기
Interstitial ad를 표시하려면 showInterstitial()을 호출하세요.
if (AppLovinMAX.isInterstitialReady(«ad-unit-ID»))
{
AppLovinMAX.showInterstitial(«ad-unit-ID»)
}