Getting started
prebid_mobile_sdk brings the Prebid Mobile SDK to Flutter on Android and iOS. Prebid runs a header-bidding auction against your Prebid Server, then either renders the winning creative itself or hands the result to your ad server.
prebid_mobile_sdk is an independent, community-maintained wrapper around the official Prebid Mobile SDKs. It is not affiliated with, endorsed by, or maintained by Prebid.org. Report problems with the plugin in its GitHub repository; for Prebid Server, bidders and the native SDKs themselves, see docs.prebid.org.
The core package depends on Prebid alone. Google Ad Manager rendering, AdMob mediation and AppLovin MAX mediation live in companion packages, so an app only bundles the ad SDKs it uses.
Install
flutter pub add prebid_mobile_sdk
Android needs no further setup: Gradle pulls the Prebid SDK from Maven Central. Your app's minSdk must be 24 or higher.
The plugin requires iOS 15. In ios/Podfile:
platform :ios, '15.0'
Then run cd ios && pod install. Swift Package Manager works too: the plugin ships a Package.swift. With Swift Package Manager, Xcode also resolves Google Mobile Ads and AppLovin, because Prebid's Package.swift declares them for its adapter products, even though the core package only links PrebidMobile. An app that pins Google Mobile Ads 12 or AppLovin below 13 can't resolve with Swift Package Manager; CocoaPods doesn't have this issue.
Call initializeSdk once at startup with your Prebid Server endpoint and account ID, and await it before loading ads: Prebid Android drops requests made before initialization completes (the plugin reports them as onAdFailed).
import 'package:flutter/widgets.dart';
import 'package:prebid_mobile_sdk/prebid_mobile_sdk.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await PrebidMobile.initializeSdk(
prebidServerUrl: 'https://prebid-server-test-j.prebid.org/openrtb2/auction',
accountId: '0689a263-318d-448b-a3d4-b02e8a709d9d',
completion: (status, error) {
if (status == PrebidInitializationStatus.failed) {
debugPrint('Prebid init failed: $error');
}
},
);
runApp(const MyApp());
}
The server and account above are Prebid's public test setup; the config IDs on this site (prebid-demo-…) return test bids from it.
PrebidBannerAd(
configId: 'prebid-demo-banner-320-50',
width: 320,
height: 50,
listener: PrebidBannerAdListener(
onAdLoaded: () => debugPrint('Banner loaded'),
onAdFailed: (error) => debugPrint('Banner failed: $error'),
),
)
Integration models
| Model | Who renders | Use |
|---|---|---|
| Prebid rendering | The Prebid SDK | PrebidBannerAd, PrebidInterstitialAd, PrebidRewardedAd, PrebidNativeAd |
| Original API | Your ad server, from Prebid's targeting keywords | PrebidBannerAdUnit and friends with google_mobile_ads |
| GAM rendering | Google Ad Manager, through Prebid's event handlers | prebid_mobile_sdk_gam |
| Mediation | AdMob or AppLovin MAX, with Prebid as a network | prebid_mobile_sdk_admob, prebid_mobile_sdk_max |
Choosing an integration compares them.
Explore
Global SDK settings, from timeouts to Prebid Server flags.
▭BannerDisplay and outstream video banners with auto-refresh.
⛶Interstitial & rewardedFullscreen display and video, rewards and controls.
▤NativeNative rendering with impression and click tracking.
⚑PrivacyConsent signals and first-party data rules.
⌗CompatibilityThe native Prebid SDK behind every release.