Skip to main content

Prerequisites

Targeting

  • Minimum SDK version of 24 or higher
  • Compile SDK version of 36 or higher

Migrate from v1 to v2

To migrate from version 1.5.1 to version 2.0.0, see this guide.

Installation

To install the SDK into your project, first add the repository to your project level Android gradle build file or settings gradle file. Gradle Kotlin DSL

Adding the library dependency

Add the latest version of the SDK to your relevant module build.gradle.
# libs.versions.toml
[versions]
contentIgnite = "2.0.0"

[libraries]
content-ignite-mobile = { group = "com.contentignite", name = "ci-mobile-sdk-android", version.ref = "contentIgnite" }
First we will create an instance of CIMobileAdsConfiguration. This is achieved using CIMobileAdsConfiguration.Builder. The builder takes one required parameter and two optional parameters:
  • publisherId: String: A unique identifier to identify the publisher in the Fusion platform.
Then call the build API to create the instance.
When creating an instance of CIMobileAdsConfiguration it is possible to enable optional features on the SDK, such as debugging via the setDebugFeature API (since version 1.2.0 the debug feature is enabled by default). This is discussed further in the Using the Debug Features section.
val configuration = CIMobileAdsConfiguration.Builder(
    publisherId = "<PUBLISHER-ID>",
    googleId = "ca-app-pub-3940256099942544~3347511713"
)
.setDebugFeature(enabled = true)
.setTestAds(enabled = true)
.build()
  • setTestAds(enabled: Boolean) was added to CIMobileAdsConfiguration.Builder in 2.3.0 to control whether test ads are enabled, this was previously only possible from the debug menu. If this is set the Debug Menu option will be hidden and if not set the Debug Menu option will be used.
The initialisation step uses a singleton instance CIMobileAds. The initialise API is a suspending function and should be called from a background thread. It takes two required parameters:
  • context: The application context.
  • configuration: An instance of CIMobileAdsConfiguration.
The call to initialise the SDK should be made as early as possible in the application lifecycle.
If you are currently using Google Mobile Ads SDK, it is not required to initialise this separately, and this code should be removed. You should also remove the link the dependency in your build.gradle file.
The example below is taken from the demo application:
import com.contentignite.mobilesdk.CIMobileAds
import com.contentignite.mobilesdk.CIInitialisationStatus

class App: Application() {

    override fun onCreate() {
        super.onCreate()

        val backgroundScope = CoroutineScope(Dispatchers.IO)
        backgroundScope.launch {
            val status = CIMobileAds.initialise(
                context = this@App,
                configuration = configuration
            )
            when (status) {
                CIInitialisationStatus.Succeeded -> println("CIMobileAds Initialised Successfully")
                CIInitialisationStatus.Failed -> println("CIMobileAds Initialisation Failed")
            }
        }
    }
}

Select an ad format

Content Ignite Mobile SDK is now imported and you’re ready to implement an ad. We support both Jetpack Compose and View-Based UI. We offer a number of different formats:

App Open

Ads that appear when a user opens or switches back to your app. Flexibily sized format for placing ads anywhere in your app.

Interstitial

Full-screen ads that are designed to appear between content transitions.