> ## Documentation Index
> Fetch the complete documentation index at: https://docs.contentignite.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction

> Get started with your Android integration

### Prerequisites

* 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](/app/android/android_migrate_v1_to_v2).

### Installation

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

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    // settings.gradle.kts
    dependencyResolutionManagement {
        repositories {
            maven(url = "https://gitlab.com/api/v4/projects/73367547/packages/maven")
        }
    }
    ```
  </Tab>

  <Tab title="Groovy">
    ```groovy theme={null}
    // settings.gradle
    dependencyResolutionManagement {
        repositories {
            maven {
                url 'https://gitlab.com/api/v4/projects/73367547/packages/maven'
            }
        }
    }
    ```
  </Tab>
</Tabs>

### Adding the library dependency

Add the latest version of the SDK to your relevant module build.gradle.

```toml theme={null}
# libs.versions.toml
[versions]
contentIgnite = "2.0.0"

[libraries]
content-ignite-mobile = { group = "com.contentignite", name = "ci-mobile-sdk-android", version.ref = "contentIgnite" }
```

<Tabs>
  <Tab title="Kotlin">
    ```kotlin theme={null}
    // build.gradle.kts(:module)
    dependencies {
        implementation(libs.content.ignite.mobile)
    }
    ```
  </Tab>

  <Tab title="Groovy">
    ```groovy theme={null}
    // build.gradle(:module)
    dependencies {
        implementation libs.content.ignite.mobile
    }
    ```
  </Tab>
</Tabs>

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.

<Note>
  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 [Debug Features](/app/android/debugging) section.
</Note>

```kotlin theme={null}
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](https://kotlinlang.org/docs/coroutines-basics.html) 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.

<Note>
  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 dependency in your build.gradle file.
</Note>

The example below is taken from the demo application:

```kotlin theme={null}
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:

<Columns cols={2}>
  <Card title="App Open (Jetpack Compose)" icon="mobile-screen-button" href="/app/android/android_app_open_compose">
    Ads that appear when a user opens or switches back to your app.
  </Card>

  <Card title="App Open (View-Based)" icon="mobile-screen-button" href="/app/android/android_app_open_view_based">
    Ads that appear when a user opens or switches back to your app.
  </Card>

  <Card title="Banner (Jetpack Compose)" icon="rectangle-ad" href="/app/android/android_banner_compose">
    Flexibly sized format for placing ads anywhere in your app.
  </Card>

  <Card title="Banner (View-Based)" icon="rectangle-ad" href="/app/android/android_banner_view_based">
    Flexibly sized format for placing ads anywhere in your app.
  </Card>

  <Card title="Interstitial" icon="window-maximize" href="/app/android/android_interstitial">
    Full-screen ads that are designed to appear between content transitions.
  </Card>
</Columns>
