Quickstart Guide
Using the Nimbus Android SDK, you can monetize your app with embedded video and static ads. Nimbus brings the "header bidding" process to in-app mobile. Nimbus holds a simultaneous auction for over a dozen major ad networks at the beginning of every user session, delivering the highest-paid ad to the user.
Build Setup
Include the following maven repository configuration in your project root build.gradle file. Your credentials for the additional repositories can be found on the Nimbus Dashboard. Contact your account manager for access to the Nimbus Dashboard.
Nimbus Dashboard Android SDK Setup
// build.gradle
allprojects {
repositories {
google()
mavenCentral()
// Add the following maven repository for access to the Nimbus SDK
maven {
url = uri("https://adsbynimbus-public.s3.amazonaws.com/android/sdks")
credentials {
username = "*"
}
content {
includeGroup("com.adsbynimbus.openrtb")
includeGroup("com.adsbynimbus.android")
// Include the following if implementing OM Viewability measurement
includeGroup("com.iab.omid.library.adsbynimbus")
}
}
}
}
In your application's build.gradle file, include the Nimbus sdk and required OkHttp extension and ensure compilation is set to target Java 8.
// app/build.gradle
apply plugin: 'com.android.application'
android {
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
// If using Kotlin
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}
}
dependencies {
implementation "com.adsbynimbus.android:nimbus:1.11.6" // Full Nimbus SDK with NimbusAdManager
implementation "com.adsbynimbus.android:extension-okhttp:1.11.6" // Use OkHttp with NimbusAdManager
}
Initialize Nimbus SDK
Nimbus.initiailize(context, [publisher key], [api Key])
Set test mode
Nimbus.setTestMode(true);
Test mode can be turned off or removed when ready to test in your production environment. Test mode is required if connecting to a development environment.
Show an Ad
final NimbusAdManager manager = new NimbusAdManager()
// Obtain the ViewGroup from your layout to attach the ad
ViewGroup adView = findViewById(R.id.ad_view);
// Call showAd for non-blocking ads, an ad will attach to 'adView' on a successful request and return in the callback
manager.showAd(NimbusRequest.forBannerAd("position", Format.BANNER_320_50, Position.FOOTER), adView, new NimbusAdManager.Listener() {
@Override
public void onAdResponse(NimbusResponse nimbusResponse) {
// Optional override to receive a callback when a successful bid is made
}
@Override
public void onAdRendered(AdController controller) {
// Ad successfully loaded, attach an event listener to listen to ad events
}
@Override
public void onError(NimbusError error) {
// Handle error
}
});
// Call showBlocking ad to show a blocking fullscreen ad
manager.showBlockingAd(NimbusRequest.forInterstitialAd("test_hybrid"), activity, new NimbusAdManager.Listener() {
@Override
public void onAdResponse(NimbusResponse nimbusResponse) {
// Optional override to receive a callback when a successful bid is made
}
@Override
public void onAdRendered(AdController controller) {
// Ad successfully loaded, attach an event listener to listen to ad events
// Call controller.stop() to hide the ad and controller.destroy() to remove it completely
}
@Override
public void onError(NimbusError error) {
// Handle error
}
});
Proguard/R8
If you are using R8, all the necessary proguard rules are included for you and should work out of the box.
If you are using Proguard or if you run into any build issues, see Proguard/R8 in Debugging to troubleshoot.
Explore the SDK
For more advanced topics continue reading using the links in the sidebar
Get support
Contact your Nimbus agent to get help with the SDK.