Liftoff Monetize

In this article, you will learn how to use Nimbus to request and render Liftoff Monetize Ads.

Integrating Nimbus with Liftoff Monetize requires an "App ID".

How it works

The SDK will automatically inject a Liftoff provided bidding token into the outbound request to Nimbus when using the NimbusAdManager. After the VungleDemandProvider is initialized it will fetch the token in the background for use on future requests and install the VungleAdRenderer to render any wins from Liftoff.

Setup

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

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

Initializing the Liftoff Monetize Extension

The Liftoff Monetize extension needs to be initialized, make sure to do this after Nimbus SDK has been initialized.

VungleDemandProvider.initialize(
    appId = TODO("application Id provided by Liftoff"),
)

Listening for initialization errors

An optional com.vungle.warren.InitCallback can be passed to the initialization method to listen for the status of the Vungle SDK initialization.

VungleDemandProvider.initialize(
    appId = TODO("application Id provided by Liftoff"),
    callback = TODO("implementation of com.vungle.warren.InitCallback"),
)

Native Ads

Starting on the version 2.15.0 of the Nimbus Android SDK , com.adsbynimbus.android:extension-vungle supports Liftoff native ads. Please follow this guide to integrate in your application.

Prerequisites

Define a Native View

In order to display a native ad, a View object must be created and configured with the information in the provided in the com.vungle.warren.NativeAdobject. To pass the view to NimbusSDK you need to set the VungleRenderer.delegate field and implement the customViewForRendering method.

VungleRenderer.delegate = object : VungleRenderer.Delegate {
    override fun customViewForRendering(container: ViewGroup, nativeAd: NativeAd): View = LayoutInflater.from(container.context)
        .inflate(R.layout.native_ad, container, false).apply {
            // you need to create a View that includes the fields necessary to display the native ad

            // configure your view using the values received in the nativeAd parameter

            // after your View is setup, call registerViewForInteraction passing the NativeAdLayout 
            // for your View and all the other views that handle interaction
            val nativeLayout = findViewById<NativeAdLayout>(R.id.native_ad_layout)
            nativeAd.registerViewForInteraction(
                nativeLayout, /* your other views */
            )
        }
}

For details of all fields available in a NativeAd please consult Liftoff Monetize Native Ad documentation.

Last updated