Skip to main content
You’ll need a publisher account 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:
video-media3 is the adapter for a 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.
The SDK depends on KontextKit, 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.
Register the class in your manifest with <application android:name=".App" …>. To hear the result, pass a listener, or call awaitInitialization() from a coroutine:
A second call is ignored. Every ads request made before initialization finishes simply waits for it, so you can create a VideoAds right away.
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

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.
  • 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.