Android

Including the Nimbus adapter for Android into your app

Setup

Include the Nimbus extension for MobileFuse in your build.gradle(.kts) file. If the MobileFuse SDK is not already included in your application the extension will import it for you.

dependencies {  
    implementation("com.adsbynimbus.android:extension-mobilefuse:2.+")  
}

Initializing the MobileFuse extension

The MobileFuse extension is initialized automatically as part of the Nimbus SDK initialization and does not require any additional configuration.

Nimbus initialization and ad requests

If you are adding MobileFuse to an existing Nimbus integration, you shouldn't need to add any of the following code. If you are setting up a fresh Nimbus integration, here are some code samples. You can also use Nimbus' documentation as a reference.

Initialize Nimbus with your publisher key and API key

Nimbus.initialize(context, publisherKey, apiKey);

Request and render a banner Ad

Format format = Format.MREC; // Medium rectangle
Format format = Format.BANNER_320_50; // Standard banner
NimbusRequest request = NimbusRequest.forBannerAd(placement, format, Position.FOOTER);

// ...

new NimbusAdManager().showAd(request, adContainer, listener);

Request and render an interstitial ad

NimbusRequest request = NimbusRequest.forInterstitialAd(placement);

new NimbusAdManager().showBlockingAd(request, 10, activity, listener);

Request and render a rewarded ad

NimbusRequest request = NimbusRequest.forRewardedVideo(placement);

new NimbusAdManager().showRewardedAd(request, 10, activity, listener);

Testing the integration

MobileFuse Hybrid can be tested by enabling test mode in the Nimbus SDK.

Nimbus.testMode = true

Nimbus will always respond with a MobileFuse ad if the extension has been installed and placements have been configured in Nimbus. If you do not see a MobileFuse test ad, please contact your Nimbus account manager or MobileFuse account rep to verify MobileFuse has been set up for the ad sizes you are requesting.

Disabling MobileFuse test ads

Nimbus test ads can be re-enabled by removing MobileFuse from the request to Nimbus.

RequestManager.interceptors.remove(MobileFuseDemandProvider)

📘

Removing the NimbusMobileFuseRequestInterceptor will prevent MobileFuse from serving on all ads; Ensure the interceptor is installed in the SDK before releasing to production!