모바일 애플리케이션에 Firebase Native AdMob을 통합할 수 있도록 해주는 플러터 플러그인으로, iOS 및 안드로이드 플랫폼을 모두 지원합니다. 개발자들은 앱의 UI 내에서 사용자 경험을 방해하지 않으면서 자연스럽게 네이티브 광고를 표시할 수 있습니다. 이 플러그인은 Firebase의 AdMob 서비스를 사용하여 네이티브 광고를 로드하고 렌더링하는 간단한 API를 제공합니다. 최신 플러터 버전과 호환되며, 광고 성능과 준수를 위한 최선의 실천 방법을 따릅니다.
사용 사례
네이티브 광고를 통한 모바일 앱 수익화
Flutter 앱에 Firebase 기반 광고 통합하기
앱 콘텐츠 내에서 리치 미디어 광고 표시
네이티브 광고 형식을 통한 사용자 참여도 향상
하나의 코드베이스로 iOS 및 Android 모두 지원
주요 기능
Firebase 네이티브 AdMob 통합
크로스 플랫폼 지원 (iOS 및 안드로이드)
광고 로딩 및 렌더링을 위한 간단한 API
AdMob 정책 준수
실시간 광고 성과 추적
적합한 대상
광고 수익화를 원하는 플러터 개발자
네이티브 광고 형식을 요구하는 앱
Firebase를 백엔드로 사용하는 프로젝트
iOS 및 안드로이드 양쪽을 대상으로 하는 개발자
고광고 참여도를 목표로 하는 앱
고려 사항
Firebase 설정 및 구성이 필요합니다
광고 사용 가능 여부는 네트워크 및 지역에 따라 다릅니다
최적화되지 않은 경우 앱 성능에 영향을 줄 수 있습니다
광고 라이프사이클 이벤트에 적절한 처리가 필요합니다
AdMob 정책 준수는 필수입니다
원본 README
연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.
flutter_native_admob
Plugin to integrate Firebase Native Admob to Flutter application
Platform supported: iOS, Android
Getting Started
For help getting started with Flutter, view our online documentation.
Setup Android project
Add the classpath to the [project]/android/build.gradle file.
dependencies {
// Example existing classpath
classpath 'com.android.tools.build:gradle:3.2.1'
// Add the google services classpath
classpath 'com.google.gms:google-services:4.3.0'
}
Add the apply plugin to the [project]/android/app/build.gradle file.
// ADD THIS AT THE BOTTOM
apply plugin: 'com.google.gms.google-services'
Add your Admob App ID.
Important: This step is required as of Google Mobile Ads SDK version 17.0.0. Failure to add this tag results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.
Important: This step is required as of Google Mobile Ads SDK version 7.42.0. Failure to add add this Info.plist entry results in a crash with the message: The Google Mobile Ads SDK was initialized incorrectly.
In your app's Info.plist file, add a GADApplicationIdentifier key with a string value of your AdMob app ID. You can find your App ID in the AdMob UI.
Stream that notify each time the loading state changed
Stream
void setAdUnitID(String adUnitID)
Change the ad unit ID, it will load the ad again if the id is changed from previous
void reloadAd({bool forceRefresh = false, int numberAds = 1})
Reload the ad with optionals number of ads
void setTestDeviceIds(List ids)
Add your test devices
void setNonPersonalizedAds(bool nonPersAds)
Set the option to disable the personalized Ads. AdMob default option: personalized
Examples
Default
NativeAdmob(
adUnitID: "<Your ad unit ID>"
)
Using controller, loading, error widget, type and options
final _controller = NativeAdmobController();
// Optional: enter your test device ids here
_controller.setTestDeviceIds([
"XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
"YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"
]);
// Optional: Set the option to disable the personalized Ads. AdMob default option: personalized
_controller.setNonPersonalizedAds(true);
NativeAdmob(
adUnitID: "<Your ad unit ID>",
loading: Center(child: CircularProgressIndicator()),
error: Text("Failed to load the ad"),
controller: _controller,
type: NativeAdmobType.full,
options: NativeAdmobOptions(
ratingColor: Colors.red,
// Others ...
),
)
When putting NativeAdmob in ListView/GridView, it will keep reloading as the PlatformView init again when scrolling to the item. To prevent from reloading and take full control of the NativeAdmob, we can create NativeAdmobController and keep it