Skip to main content
Version: v1.0.0

Debugging

Bid inspector​

setEventListener receives every request the Prebid-rendered ads send to Prebid Server, and the server's response, as JSON strings:

await PrebidMobile.setEventListener((request, response) {
debugPrint('Prebid request: $request');
debugPrint('Prebid response: $response');
});

// Stop listening:
await PrebidMobile.setEventListener(null);

Original API requests (PrebidBannerAdUnit, PrebidMultiformatAd, …) don't go through this listener: read them in the native log instead (below).

Stored responses​

Prebid Server can answer from stored data instead of running a live auction, which makes tests deterministic:

// The whole auction response.
await PrebidMobile.setStoredAuctionResponse('your-stored-auction-response-id');
await PrebidMobile.clearStoredAuctionResponse();

// One bidder's response.
await PrebidMobile.addStoredBidResponse('appnexus', 'your-stored-bid-response-id');
await PrebidMobile.clearStoredBidResponses();

The stored response stays set until you clear it, including after a banner is disposed (Prebid iOS clears it when a banner is deallocated; the plugin restores it).

Prebid Server debug​

await PrebidMobile.setPbsDebug(true); // test: 1, debug output in ext.debug

Native logs​

await PrebidMobile.setLogLevel(PrebidLogLevel.debug);
  • Android: adb logcat | grep -i prebid. At the debug level, every request and response body is logged (PrebidBaseNetworkTask).
  • iOS: the Xcode console, or Console.app filtered on your app.

To collect them in your app (a crash reporter, an in-app console), route them to a listener; they no longer reach the console until you pass null:

await PrebidMobile.setLogListener((level, message) {
if (level.index >= PrebidLogLevel.warn.index) myReporter.log(message);
});

PrebidLogLevel.none silences Prebid entirely. Android has no verbose or severe level: those log at debug and error.

iOS only PrebidMobile.setDebugLogFileEnabled(true) also writes Prebid's log to a file in the app's documents directory, to collect it from a test device.

Versions​

final version = await PrebidMobile.getSdkVersion();

returns the native Prebid SDK version. The Compatibility page lists the version each release bundles.

Example app​

The repository's example/ app has 90+ test cases mirroring Prebid's internal test app (In-App, GAM rendering, GAM Original API, AdMob and MAX), with every callback logged per case, the bid inspector, and screens for every SDK setting and targeting field:

git clone https://github.com/thanhhaidev/prebid-mobile-flutter.git
cd prebid-mobile-flutter/example
flutter run