gma_all_mediations 0.0.4
gma_all_mediations: ^0.0.4 copied to clipboard
A zero-config AdMob mediation suite for Flutter. Automates UMP/GDPR/CCPA consent, ATT prompts, and 13+ native adapters.
GMA All Mediations 🚀 #
A zero-config, ultra-robust Flutter package that automatically manages Google AdMob Mediation, native adapter registration, and consent propagation (GDPR/CCPA/ATT) for 13+ top ad networks. Stop editing your MainActivity or AppDelegate and stop writing manual consent bridges. Install the adapters, initialize the package, and you are done.
⚠️ IMPORTANT ACTION: For all mediations to work properly and serve ads on production, you MUST update your
app-ads.txtfile on your developer website to include the IDs provided by each ad network.
🌟 Features #
- Zero Native Code: You do not have to touch any Java, Kotlin, Swift, or Objective-C code for 99% of use cases.
- Auto-Propagating Consent: Automatically sends GDPR, CCPA, and UMP consent strings to third-party ad networks natively (via the User Messaging Platform).
- App Tracking Transparency (ATT): Automatically handles the iOS 14+ ATT prompt and forwards the tracking status directly to the iOS SDKs (like Meta Audience Network).
📦 Supported Adapters #
These are the currently maintained and actively supported mediation adapters.
| Ad Network | Package Dependency | Action Required? | Consent Strategy |
|---|---|---|---|
| AppLovin | gma_mediation_applovin |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| Chartboost | gma_mediation_chartboost |
✅ Info.plist flag | Handled natively by UMP + SKAN IDs |
| DT Exchange | gma_mediation_dtexchange |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| InMobi | gma_mediation_inmobi |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| IronSource | gma_mediation_ironsource |
✅ Info.plist flag | Exact Boolean setter execution (Dart) |
| Liftoff (Vungle) | gma_mediation_liftoffmonetize |
✅ Info.plist flag | Exact Boolean setter execution (Dart) |
| Meta (Facebook) | gma_mediation_meta |
✅ Info.plist flag | UMP + Auto-ATT Tracking execution |
| Mintegral | gma_mediation_mintegral |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| Moloco | gma_mediation_moloco |
❎ None | Auto-forwarded natively by UMP |
| myTarget | gma_mediation_mytarget |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| Pangle | gma_mediation_pangle |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| PubMatic | gma_mediation_pubmatic |
✅ Info.plist flag | Auto-forwarded natively by UMP |
| Unity Ads | gma_mediation_unity |
✅ Info.plist flag | Auto-forwarded natively by UMP |
🚀 Getting Started #
1. Installation #
First, add gma_all_mediations along with the mediation packages you plan to use to your pubspec.yaml:
dependencies:
gma_all_mediations: any
google_mobile_ads: ^7.0.0
2. Initialization #
Initialize the package before requesting any ads. GmaAllMediations.instance acts as your central hub.
🔥 Required Code (Minimal Setup)
import 'package:gma_all_mediations/gma_all_mediations.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Initialize and automatically propagate to all installed SDKs!
await GmaAllMediations.instance.initialize();
runApp(const MyApp());
}
⚙️ Optional Code (Advanced Configuration)
import 'package:gma_all_mediations/gma_all_mediations.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
// 1. Configure the Mediation Setup
// (All parameters are optional and have sensible defaults)
final config = GmaMediationConfig(
enableATT: true,
debug: true,
doNotSell: false,
// Add custom CCPA/GDPR/UMP logic here if you want to override UMP defaults
);
// 2. Initialize and automatically propagate to all installed SDKs!
await GmaAllMediations.instance.initialize(config: config);
runApp(const MyApp());
}
⚙️ Platform Specific Setup #
While gma_all_mediations requires no structural bridging code, some Ad SDKs strictly require specific Maven repositories (Android) or Info.plist setup (iOS) from the host app.
🤖 Android Setup #
💡 Example File: See our full example_build_gradle.txt for a complete working Android configuration.
Maven Repositories (android/build.gradle or settings.gradle)
If you are using Chartboost, IronSource, Mintegral, Pangle, or PubMatic, you must add their Maven repositories to your project.
Note: For modern Flutter apps using dependencyResolutionManagement, put this in settings.gradle instead.
allprojects {
repositories {
google()
mavenCentral()
// Chartboost
maven { url "https://cboost.jfrog.io/artifactory/chartboost-ads/" }
// IronSource
maven { url "https://android-sdk.is.com/" }
// Mintegral
maven { url "https://dl-maven-android.mintegral.com/repository/mbridge_android_sdk_oversea" }
// Pangle
maven { url "https://artifact.bytedance.com/repository/pangle/" }
// PubMatic
maven { url "https://repo.pubmatic.com/artifactory/public-repos" }
}
}
Lint Crashes (android/build.gradle)
Important: To prevent
NullSafeMutableLiveDatalint crashes during Android builds, add this to thesubprojectsblock:
subprojects {
afterEvaluate { project ->
if (project.plugins.hasPlugin("com.android.application") || project.plugins.hasPlugin("com.android.library")) {
android {
lint { disable "NullSafeMutableLiveData" }
}
}
}
}
🍎 iOS Setup (ios/Runner/Info.plist) #
💡 Example File: See our full example_info_plist.txt for a complete working iOS configuration including all SKAdNetwork IDs.
App Tracking Transparency (ATT)
To accurately track attribution context (Meta, Liftoff, etc.), provide your tracking usage prompt inside Info.plist:
<key>NSUserTrackingUsageDescription</key>
<string>This identifier will be used to deliver personalized ads to you.</string>
Meta Audience Network Tracking Flag
If using Meta, you must supply this flag to unlock network attribution tracking natively:
<key>FacebookAdvertiserTrackingEnabled</key>
<true/>
SKAdNetwork IDs
Almost every adapter on iOS relies on SKAdNetworkItems for view/click conversions mapping.
Rather than bloating your
Info.plistwith thousands of lines, always retrieve the latest SKAdNetwork XMLs supplied directly by the ad networks you configure. Add them sequentially into the<key>SKAdNetworkItems</key>array tag.
- AppLovin SKAdNetwork IDs
- Chartboost SKAdNetwork IDs
- DT Exchange SKAdNetwork IDs
- InMobi SKAdNetwork IDs - Info.plist
- IronSource SKAdNetwork IDs
- Liftoff Monetize SKAdNetwork IDs - Info.plist
- Meta SKAdNetwork IDs
- Mintegral SKAdNetwork IDs
- myTarget SKAdNetwork IDs
- Pangle SKAdNetwork IDs
- PubMatic SKAdNetwork IDs
- Unity Ads SKAdNetwork IDs
🤝 Open Source #
We maintain the latest robust reflections and implementations across 13 major mobile mediation networks. Open a GitHub pull request to add support for a new AdMob-certified SDK!