빠른 시작 가이드에서는 Google 모바일 광고 SDK를 초기화하는 방법을 보여줍니다.
초기화 호출 중에는 미디에이션 어댑터도 초기화됩니다. 첫 번째 광고 요청에 모든 광고 네트워크가 참여할 수 있도록 하려면 광고를 로드하기 전에 초기화가 완료될 때까지 기다려야 합니다.
다음 샘플 코드에서는 광고 요청을 하기 전에 각 어댑터의 초기화 상태를 확인하는 방법을 보여줍니다.
voidmain(){WidgetsFlutterBinding.ensureInitialized();MobileAds.instance.initialize().then((initializationStatus){initializationStatus.adapterStatuses.forEach((key,value){debugPrint('Adapter status for $key: ${value.description}');});});runApp(MyApp());}
Gradle 설정 업데이트 (Android만 해당)
플러그인의 Android API를 사용할 수 있도록 settings.gradle 파일에 다음 줄을 추가합니다.
defflutterSdkPath={defproperties=newProperties()file("local.properties").withInputStream{properties.load(it)}defflutterSdkPath=properties.getProperty("flutter.sdk")assertflutterSdkPath!=null,"flutter.sdk not set in local.properties"returnflutterSdkPath}()includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
파트너 네트워크의 종속 항목 추가
미디에이션 어댑터와 종속 항목을 Android 및 iOS 프로젝트에 추가해야 합니다. Android의 앱 수준 build.gradle 파일과 iOS의 Podfile를 업데이트하여 추가할 수 있습니다. Google에는 Android와 iOS 모두를 위한 GitHub의 오픈소스 어댑터가 있습니다.
앱에 어댑터를 추가하는 방법에 관한 자세한 안내는 각 파트너 네트워크의 Android 및 iOS 문서를 참고하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-06(UTC)"],[[["\u003cp\u003eThis guide explains how to integrate mediation adapters, allowing you to display ads from multiple ad networks within your Flutter app to maximize revenue.\u003c/p\u003e\n"],["\u003cp\u003eBefore integrating mediation, you must integrate the desired ad formats (banner, interstitial, native, rewarded, rewarded interstitial) into your app and initialize the Mobile Ads SDK.\u003c/p\u003e\n"],["\u003cp\u003eYou need to add the necessary dependencies for your chosen partner ad networks to your Android and iOS projects, updating your \u003ccode\u003ebuild.gradle\u003c/code\u003e and \u003ccode\u003ePodfile\u003c/code\u003e accordingly.\u003c/p\u003e\n"],["\u003cp\u003eFor banner ads used in mediation, disable refresh in third-party ad source UIs to prevent double refreshes, and for native ads, ensure your app complies with each ad network's policies and relevant privacy regulations.\u003c/p\u003e\n"]]],["To integrate mediation with a Flutter app, first initialize the Mobile Ads SDK, ensuring all mediation adapters are initialized before loading ads. Update the `settings.gradle` file (Android) and add dependencies for partner networks in `build.gradle` (Android) and `Podfile` (iOS). Check adapter initialization status and log the ad network class name upon ad load. Disable refresh in third-party ad UIs for banner ads. Finally, comply with U.S. states privacy laws or GDPR by adding mediation partners to the relevant lists in Ad Manager Privacy & messaging.\n"],null,["\u003cbr /\u003e\n\nThis guide shows you how to integrate a mediation adapter with your\nFlutter app.\n\nPrerequisites\n\nBefore you can integrate mediation for an ad format, you need to integrate that\nad format into your app:\n\n- [Banner Ads](/ad-manager/mobile-ads-sdk/flutter/banner)\n- [Interstitial Ads](/ad-manager/mobile-ads-sdk/flutter/interstitial)\n- [Native Ads](/ad-manager/mobile-ads-sdk/flutter/native)\n- [Rewarded Ads](/ad-manager/mobile-ads-sdk/flutter/rewarded)\n- [Rewarded Interstitial\n Ads](/ad-manager/mobile-ads-sdk/flutter/rewarded-interstitial)\n\nNew to mediation? Read\n\n[Introduction to mediation](//support.google.com/admanager/answer/6272813).\n\nInitialize Google Mobile Ads SDK\n\nThe quick start guide shows you how to [initialize the Google Mobile Ads SDK](/ad-manager/mobile-ads-sdk/flutter/quick-start#initialize_the_mobile_ads_sdk).\nDuring that initialization call, mediation adapters also\nget initialized. It is important to wait for initialization to complete before\nyou load ads in order to verify full participation from every ad network on the\nfirst ad request.\n| **Important:** Bidding adapters require you to explicitly initialize Google Mobile Ads SDK.\n\nThe following sample code shows how you can check each adapter's initialization\nstatus prior to making an ad request. \n\n void main() {\n WidgetsFlutterBinding.ensureInitialized();\n MobileAds.instance.initialize()\n .then((initializationStatus) {\n initializationStatus.adapterStatuses.forEach((key, value) {\n debugPrint('Adapter status for $key: ${value.description}');\n });\n });\n runApp(MyApp());\n }\n\nUpdate your gradle settings (Android only)\n\nAdd the following lines to your `settings.gradle` file, so you can use the\nplugin's Android APIs: \n\n def flutterSdkPath = {\n def properties = new Properties()\n file(\"local.properties\").withInputStream { properties.load(it) }\n def flutterSdkPath = properties.getProperty(\"flutter.sdk\")\n assert flutterSdkPath != null, \"flutter.sdk not set in local.properties\"\n return flutterSdkPath\n }()\n\n includeBuild(\"$flutterSdkPath/packages/flutter_tools/gradle\")\n\nAdd dependencies for partner networks\n\nThe mediation adapters and their dependencies need to be added to your Android\nand iOS projects. They can be added by updating your app level `build.gradle`\nfile on Android and `Podfile` on iOS. Google has open source adapters in GitHub\nfor both\n[Android](//github.com/googleads/googleads-mobile-android-mediation/tree/master/ThirdPartyAdapters)\nand\n[iOS](//github.com/googleads/googleads-mobile-ios-mediation/tree/main/adapters).\n\nSee the\n[Android](/ad-manager/mobile-ads-sdk/android/choose-networks#network_details)\nand\n[iOS](/ad-manager/mobile-ads-sdk/ios/choose-networks#network_details)\ndocumentation for each partner network for detailed guidance of how to add their\nadapter in your app.\n\nCheck which ad network adapter class loaded the ad\n\nThe following sample code demonstrates how to log the ad network class name for\na banner ad: \n\n final bannerAd = AdManagerBannerAd(\n size: [AdSize.banner],\n adUnitId: '\u003cyour-ad-unit\u003e',\n listener: AdManagerBannerAdListener(\n onAdLoaded: (ad) {\n debugPrint('$ad loaded: ${ad.responseInfo?.mediationAdapterClassName}');\n },\n ),\n request: AdManagerAdRequest(),\n );\n\nUse banner ads with mediation\n\nMake sure to disable refresh in all third-party ad source UIs for banner ad\nunits used in mediation. This prevents a\ndouble refresh since Ad Manager also triggers a refresh\nbased on your banner ad unit's refresh rate.\n\nUse native ads with mediation\n\nThe following are some best practices to consider when implementing native\nmediation.\n\nNative ad presentation policy\n: Each ad network has its own policies. When using mediation, it's important to\n remember that your app still needs to abide by the policies of the mediated\n network that provided the ad.\n\nUS states privacy laws and GDPR\n\nIf you need to comply with the [U.S. states privacy\nlaws](//support.google.com/admanager/answer/9561023) or [General Data Protection\nRegulation (GDPR)](//support.google.com/admanager/answer/7666366), follow the\nsteps in [US state regulations\nsettings](//support.google.com/admanager/answer/10115735) or [GDPR\nsettings](//support.google.com/admanager/answer/10113006#adding_ad_partners_to_published_gdpr_messages) to add your\nmediation partners in Ad Manager Privacy \\& messaging's\nUS states or GDPR ad partners list. Failure to do so can lead to partners\nfailing to serve ads on your app.\n\nLearn more about enabling [restricted data processing\n(RDP)](/ad-manager/mobile-ads-sdk/flutter/privacy/us-states) and obtaining GDPR consent with the\n[Google User Messaging Platform (UMP) SDK](/ad-manager/mobile-ads-sdk/flutter/privacy)."]]