Skip to main content
Version: v1.1.0

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.

Unofficial project

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​

Add the package
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.

Set the iOS platform

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.

Initialize the SDK

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.

Show a banner
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​

ModelWho rendersUse
Prebid renderingThe Prebid SDKPrebidBannerAd, PrebidInterstitialAd, PrebidRewardedAd, PrebidNativeAd
Original APIYour ad server, from Prebid's targeting keywordsPrebidBannerAdUnit and friends with google_mobile_ads
GAM renderingGoogle Ad Manager, through Prebid's event handlersprebid_mobile_sdk_gam
MediationAdMob or AppLovin MAX, with Prebid as a networkprebid_mobile_sdk_admob, prebid_mobile_sdk_max

Choosing an integration compares them.

Explore​