Browse documentation

Instrument

Android

Capture Android identity, events, errors, crashes, and backend request context.

The native Kotlin SDK supports Android minSdk 24 and has no third-party runtime dependency. Add the published Maven coordinate or the early-access artifact supplied during onboarding.

Add the dependency

dependencies {
    implementation("io.teml:sdk:0.1.0")
    // Optional when using the Teml OkHttp interceptor:
    implementation("com.squareup.okhttp3:okhttp:4.12.0")
}

The SDK’s INTERNET permission is merged into the application manifest.

Initialize once

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        Teml.init(
            this,
            TemlOptions(
                apiKey = BuildConfig.TEML_API_KEY,
                environment = "production",
                release = "com.acme.shop@2.4.1+241",
                dist = "241",
                enableCrashReporting = true,
                debug = BuildConfig.DEBUG,
            ),
        )
    }
}

serviceName defaults to the application ID and serviceVersion to versionName. Methods called before init are no-ops with a warning.

Use a project-scoped key with ingest:write and analytics:write. Do not include read, management, or agent scopes in the application.

Connect identity and events

Teml.identify("user_8842", mapOf("email" to "buyer@acme.example", "plan" to "pro"))
Teml.group("company", "acme", mapOf("plan" to "enterprise"))
Teml.capture("checkout_started", mapOf("cart_size" to 3))
Teml.screen("Checkout")

// On logout:
Teml.reset()

Capture errors and upload mappings

try {
    checkout()
} catch (error: Exception) {
    Teml.captureError(error, CaptureOptions(tags = mapOf("screen" to "checkout")))
}

Fatal exceptions and failed manual error sends are spooled and retried on the next launch. Upload the exact R8/ProGuard mapping for the captured release and dist:

teml symbols upload-proguard mapping.txt --release "$RELEASE" --dist "$DIST"

Propagate to your backend

For OkHttp:

val client = OkHttpClient.Builder()
    .addInterceptor(io.teml.sdk.okhttp.TemlInterceptor())
    .build()

For HttpURLConnection, call TemlPropagation.apply(connection). Send these headers only to trusted application services.

Verify

Identify a test user, capture one event and caught error, call Teml.flush, and confirm the evidence shares one customer. Test a fatal crash only in a safe test build, then relaunch so the spool drains.