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

# Installation

> Add the Video SDK to your Android project, initialize it at launch, and see what it adds to your manifest.

> [!NOTE]
>
> You'll need a [publisher account](https://docs.kontext.so/publishers.md#getting-started-is-easy) to obtain your `publisherToken`.

## 1. Add the SDK

The SDK is on Maven Central. Make sure `mavenCentral()` is in your repositories, then add the dependency to your app module's `build.gradle.kts`:

```kotlin theme={null}
dependencies {
    implementation("so.kontext:video:0.1.0")
    implementation("so.kontext:video-media3:0.1.0")   // optional: ads.track(exoPlayer)
}
```

`video-media3` is the adapter for a [Media3](https://developer.android.com/media/media3) player (`ExoPlayer`, `MediaController`). Add it when your content plays in one; your app's own Media3 version is used. Pin an exact version: while the SDK is below 1.0, a new minor version can change the API, so you move to it when you choose.

> [!NOTE]
>
> The SDK depends on [KontextKit](https://github.com/kontextso/kontextkit-android), shared Android primitives (install id, device info, advertising id, consent). Gradle pulls it in for you. Neither ships R8 rules you need to add: nothing in them is reached by reflection.

## 2. Initialize at launch

Call `initialize` once, in your `Application.onCreate`. It stores the configuration and calls the server in the background; nothing waits on it.

```kotlin theme={null}
import so.kontext.video.Configuration
import so.kontext.video.KontextVideo

class App : Application() {
    override fun onCreate() {
        super.onCreate()
        KontextVideo.initialize(this, Configuration("<your-publisher-token>"))
    }
}
```

Register the class in your manifest with `<application android:name=".App" …>`. To hear the result, pass a listener, or call `awaitInitialization()` from a coroutine:

```kotlin theme={null}
KontextVideo.initialize(this, Configuration("<your-publisher-token>")) { state -> … }

val state = KontextVideo.awaitInitialization()
```

A second call is ignored. Every ads request made before initialization finishes simply waits for it, so you can create a `VideoAds` right away.

> [!NOTE]
>
> Call `KontextVideo`, `VideoAds` and `VideoAd` from the main thread, the default in Activities, Fragments, Compose and `lifecycleScope`. Listeners and callbacks are delivered on the main thread too.

### Configuration

```kotlin theme={null}
Configuration("<your-publisher-token>") {
    logLevel = Configuration.LogLevel.WARNING   // NONE, ERROR, WARNING, INFO, DEBUG
}
```

Use `LogLevel.DEBUG` while integrating; it logs every request, every ad and every beacon to Logcat under the tag `KontextVideo` (`adb logcat -s KontextVideo`).

## 3. What the SDK adds to your manifest

Nothing to configure: manifest merger adds these for you.

* `INTERNET` and `ACCESS_NETWORK_STATE`, for the ads requests and the connection type.
* `com.google.android.gms.permission.AD_ID`, so the SDK can read the advertising id on Android 13 and later. There is no runtime prompt; the SDK reads the id from Google Play services and sends none when the viewer opted out. See [IFA & ATT](https://docs.kontext.so/video/guides/ifa.md#android-gaid).
* The SDK's own Activity for linear ads.

Android has no App Tracking Transparency and no SKAdNetwork: there is no `Info.plist` step and no attribution identifier to add.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.