Android SDK
Jetpack Compose components via Maven Central with Kotlin coroutines and Material 3 theming.
I want to set up Koah's Android SDK. Read https://docs.koahlabs.com/SKILL.md and follow its instructions.
Koah 1.0 is stable. 1.0.0 is live on Maven Central — pin the exact version shown below. Upgrading from 0.x? Follow the migration guide. Questions: support@koahlabs.com.
Prerequisites
- A Koah account — if you don't have one, apply for access
- Your publisher ID from the dashboard
- Android 6.0+ (API 23) and Jetpack Compose — the ad components are composables
Install
Add the dependency
Add the SDK to your app's build.gradle.kts — see the latest version on Maven Central.
dependencies {
implementation("com.koahlabs:koah-android:1.0.0")
}
Initialize the SDK
Initialize Koah in your Application class (or main activity).
import com.koahlabs.android.Koah
class YourApplication : Application() {
override fun onCreate() {
super.onCreate()
Koah(context = this) {
publisherId = "YOUR_PUBLISHER_ID"
}
}
}
Display an ad
Render an ad with KoahCard. Pass a KoahAdContext describing the surface (see Ad context) and a stable cacheKey.
import com.koahlabs.android.KoahAdContext
import com.koahlabs.android.KoahCard
KoahCard(
adContext = KoahAdContext.Conversation(question = question, answer = answer),
cacheKey = messageId,
)
For borderless rendering use KoahAd instead, and react to lifecycle events with the optional onEvent callback — see Card chrome and Event handling.
Style & size your adsOptional
Theme ads to match your brand and bound each slot's size from one place — see theming and sizing on the Appearance page.
Best Practices
- Initialize the SDK as early as possible in your app's lifecycle.
- For feeds, prefer
requestAd+ conditional render (reserve / collapse) over an unconditionalKoahCard, so no-fills don't leave dead space — see Use Cases.
Next Steps
- Use Cases — Feed prefetching and other display patterns
- Appearance — Theming, sizing, and card chrome
- Reference — Theme properties and ad lifecycle events
- Visitor Attributes — Improve ad targeting with anonymous signals
- Changelog — Version history and release notes