> ## Documentation Index
> Fetch the complete documentation index at: https://guide.daro.so/llms.txt
> Use this file to discover all available pages before exploring further.

# 인터스티셜 광고

> DARO Flutter SDK를 통해 인터스티셜 광고를 구현하는 방법을 알아봅니다.

## 인터스티셜 광고 포맷 소개

* 화면 전체를 덮는 형태로 노출되는 광고입니다.
* 이미지/동영상 모두 포함되나 동영상 소재가 더 많이 노출되며 일반적으로 5초 후부터 스킵이 가능합니다.

![Interstitial Example Image Pn](https://mintcdn.com/delightroom-5a71a6a8/dxU0bpsPoPvkYh_g/sdk-integration/common-img/ad-formats/interstitial-example-image.png?fit=max\&auto=format\&n=dxU0bpsPoPvkYh_g\&q=85\&s=fa0468f45283f40d5937e24afde61f88)

### 동작 방식

![Interstitial Example Gif Kor Gi](https://mintcdn.com/delightroom-5a71a6a8/dxU0bpsPoPvkYh_g/sdk-integration/common-img/ad-formats/interstitial-example-gif-kor.gif?s=7acbabb11ba699d443e6df486522954f)

***

## 인스턴스 생성 및 콜백 설정

`DaroInterstitialAd` 인스턴스를 생성하고 콜백을 설정합니다.

```dart theme={null}
import 'package:daro_flutter/daro_flutter.dart';
```

```dart theme={null}
final interstitialAd = DaroInterstitialAd(adUnitKey: 'YOUR_AD_UNIT_KEY');

interstitialAd.onAdLoadSuccess = (adInfo) {
  print('Interstitial ad loaded');
};
interstitialAd.onAdLoadFail = (error) {
  print('Interstitial ad failed to load: ${error.message}');
};
interstitialAd.onAdImpression = (adInfo) {
  print('Interstitial ad impression');
};
interstitialAd.onAdClicked = (adInfo) {
  print('Interstitial ad clicked');
};
interstitialAd.onAdShown = (adInfo) {
  print('Interstitial ad shown');
};
interstitialAd.onAdFailedToShow = (error) {
  print('Interstitial ad failed to show: ${error.message}');
};
interstitialAd.onAdDismiss = (adInfo) {
  print('Interstitial ad dismissed');
};
```

## 광고 로드하기

`load()`를 호출하여 광고를 로드합니다.

```dart theme={null}
interstitialAd.load();
```

## 광고 보여주기

`isReady()`로 광고 준비 여부를 확인한 후 `show()`로 광고를 표시합니다.

```dart theme={null}
final isReady = await interstitialAd.isReady();

if (isReady) {
  interstitialAd.show();
}
```

광고가 닫히면 `isReady()`는 `false`를 반환합니다. 다음 광고를 표시하려면 같은 인스턴스에서 `load()`를 다시 호출하고 `onAdLoadSuccess` 콜백을 기다리세요.

## iOS 광고 표시 중 상태바 숨기기

Flutter SDK **2.0.5 이상**에서 사용할 수 있습니다.

상태바와 광고의 닫기 버튼이 겹치는 경우 `hideStatusBarDuringFullscreenAd`를 활성화할 수 있습니다. 기본값은 `false`이며 Android에서는 시스템 UI를 변경하지 않습니다.

```dart theme={null}
final ad = DaroInterstitialAd(
  adUnitKey: 'YOUR_AD_UNIT_KEY',
  hideStatusBarDuringFullscreenAd: true,
);
```

SDK는 상태바 숨김 요청을 완료한 뒤 광고를 표시합니다. 광고 종료 또는 표시 실패 후에는 기본적으로 `SystemUiMode.edgeToEdge`로 복구합니다. `show()`의 반환은 광고 종료를 의미하지 않으므로, 호출 직후 앱에서 상태바를 복구하지 마세요.

이 옵션을 켠 iOS에서는 광고 표시 세션이 끝나기 전에 같은 인스턴스에서 `load()` 또는 `show()`를 호출하면 `StateError`가 발생합니다. 따라서 `onAdShown`에서 같은 인스턴스를 미리 로드하지 말고, `onAdDismiss` 또는 `onAdFailedToShow` 이후에 `load()`를 호출하세요.

앱이 평소 상태바를 숨기거나 수동 시스템 UI 설정을 사용한다면 복구할 설정을 명시하세요. Flutter는 현재 시스템 UI 설정을 조회하는 API를 제공하지 않으므로, SDK가 임의의 이전 설정을 자동으로 읽어 복구하지는 않습니다.

```dart theme={null}
import 'package:flutter/services.dart';
import 'package:daro_flutter/daro_flutter.dart';

final ad = DaroInterstitialAd(
  adUnitKey: 'YOUR_AD_UNIT_KEY',
  hideStatusBarDuringFullscreenAd: true,
  systemUiRestoreConfiguration: DaroSystemUiRestoreConfiguration(
    mode: SystemUiMode.manual,
    overlays: const [SystemUiOverlay.bottom], // 앱의 평소 상태: 상태바 숨김
  ),
);
```

광고 표시 중 `dispose()`를 호출해도 이미 표시된 광고를 강제로 닫지 않습니다. SDK는 실제 광고 종료 또는 표시 실패 콜백을 받은 뒤 시스템 UI를 복구합니다.

`SystemUiMode.manual`에는 `overlays` 목록을 반드시 전달해야 합니다. 빈 목록은 모든 시스템 UI 오버레이를 숨기는 설정입니다.

동시에 활성화된 광고 세션이 있으면 첫 세션의 복구 설정을 사용하고, 마지막 세션 종료 후 복구합니다. 광고 표시 중 앱이 별도로 `SystemChrome` 설정을 변경하면 SDK의 복구 설정이 마지막에 적용될 수 있습니다.

> [!WARNING]
>
> 상태바 숨김은 Flutter·iOS 버전, `UIViewControllerBasedStatusBarAppearance` 설정과 광고 화면의 제어권에 영향을 받습니다. iOS 27 SDK로 빌드한 앱에서 이 키가 `NO`이면 `SystemChrome` 설정이 무시되는 [Flutter 이슈](https://github.com/flutter/flutter/issues/192842)가 보고되어 있습니다. 키를 변경할 때는 앱 전체의 상태바 동작과 사용 중인 광고 디맨드에서 표시·종료를 함께 확인하세요.

## 리소스 해제

광고 사용이 끝나면 `dispose()`를 호출하여 리소스를 해제합니다.

```dart theme={null}
interstitialAd.dispose();
```

### 구현 예시

> [accordion] `DaroInterstitialAd` 구현 예시입니다.
>
> ```dart theme={null}
> import 'package:flutter/material.dart';
> import 'package:daro_flutter/daro_flutter.dart';
>
> class InterstitialAdPage extends StatefulWidget {
>   const InterstitialAdPage({super.key});
>
>   @override
>   State<InterstitialAdPage> createState() => _InterstitialAdPageState();
> }
>
> class _InterstitialAdPageState extends State<InterstitialAdPage> {
>   late final DaroInterstitialAd _interstitialAd;
>   String _status = 'Not Loaded';
>
>   @override
>   void initState() {
>     super.initState();
>     _interstitialAd = DaroInterstitialAd(adUnitKey: 'YOUR_AD_UNIT_KEY');
>     _setupCallbacks();
>   }
>
>   void _setupCallbacks() {
>     _interstitialAd.onAdLoadSuccess = (adInfo) {
>       setState(() => _status = 'Loaded');
>     };
>
>     _interstitialAd.onAdLoadFail = (error) {
>       setState(() => _status = 'Failed to Load');
>       print('Interstitial ad failed to load: ${error.message}');
>     };
>
>     _interstitialAd.onAdShown = (adInfo) {
>       setState(() => _status = 'Shown');
>     };
>
>     _interstitialAd.onAdFailedToShow = (error) {
>       setState(() => _status = 'Failed to Show');
>     };
>
>     _interstitialAd.onAdDismiss = (adInfo) {
>       setState(() => _status = 'Not Loaded');
>     };
>
>     _interstitialAd.onAdClicked = (adInfo) {
>       print('Interstitial ad clicked');
>     };
>
>     _interstitialAd.onAdImpression = (adInfo) {
>       print('Interstitial ad impression');
>     };
>   }
>
>   @override
>   void dispose() {
>     _interstitialAd.dispose();
>     super.dispose();
>   }
>
>   @override
>   Widget build(BuildContext context) {
>     return Scaffold(
>       appBar: AppBar(title: const Text('Interstitial Ad')),
>       body: Center(
>         child: Column(
>           mainAxisAlignment: MainAxisAlignment.center,
>           children: [
>             Text('Status: $_status'),
>             const SizedBox(height: 16),
>             ElevatedButton(
>               onPressed: () async {
>                 final isReady = await _interstitialAd.isReady();
>                 if (isReady) {
>                   _interstitialAd.show();
>                 } else {
>                   setState(() => _status = 'Loading...');
>                   _interstitialAd.load();
>                 }
>               },
>               child: Text(_status == 'Loaded' ? 'Show Interstitial' : 'Load Interstitial'),
>             ),
>           ],
>         ),
>       ),
>     );
>   }
> }
> ```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.