Get your ingest key
Create a project in the Codeskop dashboard and copy its public ingest key:
cs_live_pk_…for production buildscs_test_pk_…for development and testing
Public keys can only send events, never read data, so they're safe to ship inside an APK.
Never use a secret key in an app
If the SDK is given a secret key (cs_…_sk_…) or anything that isn't a public Codeskop key, it refuses to start and captures nothing. It won't crash your app.Option A: zero code (manifest)
Add your key to AndroidManifest.xml. The SDK starts itself through AndroidX App Startup before Application.onCreate runs, and does its setup off the main thread.
<application ...> <meta-data android:name="codeskop.api_key" android:value="cs_live_pk_YOUR_KEY" /></application>| Option | Type | Default | Description |
|---|---|---|---|
| codeskop.api_key | string | None | Your public ingest key. Required; without it, auto-init does nothing. |
| codeskop.endpoint | string | https://api.codeskop.com | Ingest URL. Only change this if Codeskop gives you a different one. |
| codeskop.capture_exception_messages | boolean | false | Send exception messages instead of [REDACTED]. Added in 0.2.0. |
Every other option keeps its default. For any other setting, use Option B.
Option B: explicit init (in code)
Call CodeskopAndroid.init from Application.onCreate. Use this when you need to choose settings at runtime or use a different key per build type.
import android.app.Applicationimport com.codeskop.sdk.android.CodeskopAndroidimport com.codeskop.sdk.core.CodeskopConfig class MyApplication : Application() { override fun onCreate() { super.onCreate() CodeskopAndroid.init( this, CodeskopConfig(apiKey = BuildConfig.CODESKOP_KEY), ) }}Keep keys out of source code
Inject the key through BuildConfig so debug builds report to your test project and release builds report to production:
android { buildFeatures { buildConfig = true } buildTypes { debug { buildConfigField("String", "CODESKOP_KEY", "\"cs_test_pk_YOUR_TEST_KEY\"") } release { buildConfigField("String", "CODESKOP_KEY", "\"cs_live_pk_YOUR_LIVE_KEY\"") } }}Use one option, not both
If your manifest has acodeskop.api_key and you call CodeskopAndroid.init, the manifest wins, because App Startup runs first. The SDK only starts once; later calls are ignored.What happens at startup
init returns immediately. On a background thread the SDK then:
- checks the key,
- reads basic device and app details (model, OS version, app version),
- fetches its remote config,
- installs crash and ANR capture,
- schedules background sync with WorkManager.
Nothing is captured until this finishes, which usually takes a moment. Every SDK method is safe to call at any time, even before init: early calls do nothing instead of throwing.
Letting users opt out
If a user has turned off analytics or diagnostics in your app, don't start the SDK for that session:
class MyApplication : Application() { override fun onCreate() { super.onCreate() if (userSettings.telemetryAllowed) { CodeskopAndroid.init(this, CodeskopConfig(apiKey = BuildConfig.CODESKOP_KEY)) } }}To pause capture while the app is running (for example, right after the user changes the setting), call Codeskop.setEnabled(false). That setting only lasts for the current process. On the next launch, the check above decides whether the SDK starts.