Aus öffentlichen Paketdaten erstellte Orientierung.
Ein Flutter-Plugin, das die Integration von Firebase Native AdMob in mobile Anwendungen ermöglicht und sowohl iOS als auch Android unterstützt. Es ermöglicht Entwicklern, native Anzeigen nahtlos innerhalb der Benutzeroberfläche ihrer App anzuzeigen, was die Monetarisierung verbessert, ohne die Benutzererfahrung zu stören. Das Plugin bietet eine einfache API zum Laden und Rendern von Native-Anzeigen über den AdMob-Service von Firebase. Es ist für die neuesten Flutter-Versionen konzipiert und folgt bewährten Praktiken für Anzeigenleistung und Compliance.
Anwendungsfälle
Mobile Apps mit Native Ads monetarisieren
Integration von Firebase-betriebenen Anzeigen in Flutter-Apps
Anzeigen von Rich-Media-Werbeanzeigen innerhalb von App-Inhalten
Steigerung der Benutzerengagement durch native Anzeigenformate
Unterstützung von iOS und Android mit einer Codebasis
Hauptmerkmale
Firebase Native AdMob-Integration
Plattformübergreifende Unterstützung (iOS und Android)
Einfache API für das Laden und Rendern von Anzeigen
Einhaltung der AdMob-Richtlinien
Echtzeit-Verfolgung der Werbeleistung
Geeignet für
Flutter-Entwickler, die Werbe-Monetarisierung suchen
Apps, die native Anzeigenformate erfordern
Projekte, die Firebase als Backend verwenden
Entwickler, die sowohl für iOS als auch für Android targeten
Apps, die auf hohen Werbeengagement abzielen
Hinweise
Erfordert Firebase-Setup und Konfiguration
Die Verfügbarkeit von Anzeigen hängt vom Netzwerk und der Region ab
Kann die App-Leistung beeinträchtigen, wenn nicht optimiert
Erforderliche ordnungsgemäße Behandlung von Anzeigen-Lebenszyklus-Ereignissen
Die Einhaltung der AdMob-Richtlinien ist obligatorisch
Original-README
Originaler README-Schnappschuss aus dem verknüpften Quell-Repository. Aktuelle Inhalte finden Sie im Repository.
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