Android SDK

Android SDK

Kotlin SDK for Android apps. Request ads, record impressions, and open tracked click URLs.

Install

Add the GitLab Maven registry for this project, then depend on tech.meridianads:sdk.

Gradle
// GitLab Maven for yelle/saas/meridian-ads
implementation("tech.meridianads:sdk:<version>")

Serve, render, click

Call serve off the main thread. Call impression when the ad is visible. Open clickUrl in a Custom Tab or browser for tracked taps.

Kotlin
val client = Client(
    appKey = BuildConfig.MERIDIAN_ADS_APP_KEY,
    secret = BuildConfig.MERIDIAN_ADS_SECRET,
)

val decision = client.serve(
    placement = "home",
    userKey = "user-42",
    context = mapOf("country" to "US", "plan" to "pro"),
)
if (decision != null) {
    client.impression(decision)
}

Next

Users and context for traits to pass in, and API reference for raw response fields.