Package selection guidance compiled from public package information, community data, and project usage.
A Flutter plugin that enables integration of Firebase Native AdMob into mobile applications, supporting both iOS and Android platforms. It allows developers to display native ads seamlessly within their app's UI, enhancing monetization without disrupting user experience. The plugin provides a straightforward API for loading and rendering native ads using Firebase's AdMob service. It is designed to work with the latest Flutter versions and follows best practices for ad performance and compliance.
Use cases
Monetizing mobile apps with native ads
Integrating Firebase-powered ads in Flutter apps
Displaying rich media ads within app content
Enhancing user engagement with native ad formats
Supporting both iOS and Android with one codebase
Key features
Firebase Native AdMob integration
Cross-platform support (iOS & Android)
Simple API for ad loading and rendering
Compliant with AdMob policies
Real-time ad performance tracking
Suitable for
Flutter developers seeking ad monetization
Apps requiring native ad formats
Projects using Firebase as backend
Developers targeting both iOS and Android
Apps aiming for high ad engagement
Considerations
Requires Firebase setup and configuration
Ad availability depends on network and region
May impact app performance if not optimized
Needs proper handling of ad lifecycle events
Compliance with AdMob policies is mandatory
Original README
Original README snapshot from the linked source repository. Visit the repository for the latest content.
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