Skip to content

Test your integration

Request Test Ads

When testing you should request ads by setting the test flag to true when initializing XMediator and when creating ad instances. We use this flag to ask the underlying networks to provide us with test ads when possible.

Info

Some networks may not support this flag and might provide other means to test their integration, so make sure to always check the ad network's documentation for any additional steps.

We do provide test Placement Ids to enable a quick way to test the integration.

Test Placement Ids
Placement Value
App key 3-15
Banner 3-15/28
Interstitial 3-15/26
Rewarded 3-15/27

Currently, these placements are only supported for these ad networks: Google Ads, AppLovin, Chartboost, Unity Ads and Liftoff Monetize.

Warning

Remember to replace these test placements with your own placements and always set the test flags to false in a production environment

Enable test mode

Set the test flag to true to see test ads when available.

val shouldRequestTestAds = BuildConfig.DEBUG

// Initialize
XMediatorAds.startWith(
    activity = activity,
    appKey = "3-15",
    initSettings = InitSettings(test = shouldRequestTestAds),
    initCallback = {
        XMediatorAds.Banner.create("3-15/28", Banner.Size.Phone)
        XMediatorAds.Interstitial.load("3-15/26")
        XMediatorAds.Rewarded.load("3-15/27")
    }
)
final boolean shouldRequestTestAds = BuildConfig.DEBUG;

// Initialize
XMediatorAds.startWith(
        activity,
        "3-15",
        new InitSettings.Builder()
                .setTest(shouldRequestTestAds)
                .build(),
        initResult -> {
            XMediatorAds.getBanner().create("3-15/28", Banner.Size.Phone.INSTANCE);
            XMediatorAds.getInterstitial().load("3-15/26");
            XMediatorAds.getRewarded().load("3-15/27");
            return Unit.INSTANCE;
        }
);

Enable verbose logging

Setting the verbose flag to true will output extra logging information to Logcat.

XMediatorAds.startWith(
    activity = activity,
    appKey = "3-15",
    initSettings = InitSettings(verbose = true),
    initCallback = {}
)
XMediatorAds.startWith(
        activity,
        "3-15",
        new InitSettings.Builder()
                .setVerbose(true)
                .build(),
        initResult -> {
            return Unit.INSTANCE;
        }
);