Skip to content
Codeskop

Android configuration

Every option you can pass to CodeskopConfig. Only apiKey is required, and the defaults suit most apps.

Example

MyApplication.kt
CodeskopAndroid.init(    this,    CodeskopConfig(        apiKey = BuildConfig.CODESKOP_KEY,        sampleRates = mapOf("api_timing" to 0.2),  // keep 20% of request timings        redactHeaders = setOf("authorization", "cookie", "set-cookie", "x-api-key"),        maxQueueMb = 10,    ),)

Options

OptionTypeDefaultDescription
apiKeyStringrequiredYour public ingest key (cs_live_pk_… or cs_test_pk_…). Any other key keeps the SDK switched off.
endpointStringhttps://api.codeskop.comWhere events are sent. Change this only for a staging environment Codeskop has given you.
sampleRatesMap<String, Double>emptyMap()The share of each event type to keep, from 0.0 to 1.0. Any type not listed is kept in full. See Sampling.
redactHeadersSet<String>"authorization", "cookie", "set-cookie"Header names whose values are replaced with [REDACTED] before an event is stored. Matched case-insensitively.
maxQueueMbInt10The most disk space the on-device queue may use. When it's full, the oldest low-priority events are dropped first. Crashes and ANRs are always kept. See Offline & sync.
flushBatchSizeInt50How many queued events are read per upload during a sync.
captureExceptionMessagesBooleanfalseSend exception and crash messages as they are. Off by default: messages are replaced with [REDACTED] because they often contain user input. Added in 0.2.0. See Exception messages.
captureScreensBooleantrueProduct analytics (Growth and Scale): record each Activity shown as a screen. Added in 0.3.0. See Track events & screens.

Exception messages

By default only the exception class and stack trace are sent, and the message is replaced with [REDACTED]. The message is often the most useful clue (“cart is empty”, “database is locked”), so if your messages don't contain personal data you can opt in:

MyApplication.kt
CodeskopConfig(    apiKey = BuildConfig.CODESKOP_KEY,    captureExceptionMessages = true,   // send messages instead of [REDACTED])

With zero-code init, add <meta-data android:name="codeskop.capture_exception_messages" android:value="true" /> to your manifest instead.

Sampling

High-volume signals such as request timings can add up. Use sampleRates to keep a share of them. The keys are event types:

  • api_timing: latency for every completed request (the most common one to sample)
  • api_error: failed requests
  • exception: handled exceptions you report with recordException
  • heartbeat: foreground presence pings

Crashes and ANRs are never sampled

crash, crash_native and anr are always kept, whatever rate you set.

Remote overrides

When the SDK starts, it fetches your project's settings from Codeskop, which you change in the dashboard under Settings → SDK settings. Those settings replace your sampleRates and maxQueueMb, can switch network capture and ANR detection off, and can turn capture off entirely. Treat the values you set in code as defaults. See Remote config.

Test and production builds

Each project has a test and a production environment, and the key decides where events go: a cs_test_pk_… key reports to Test, a cs_live_pk_… key to Production. Use the test key in debug builds so your own testing never mixes with real users:

Kotlin
CodeskopConfig(    apiKey = if (BuildConfig.DEBUG) "cs_test_pk_YOUR_TEST_KEY" else "cs_live_pk_YOUR_LIVE_KEY",)

On the dashboard, the Environment filter on the Issues page switches between the two. Test events aren't billed.

Options reserved for later releases

CodeskopConfig also accepts environment, captureNetwork, captureHeaders, captureBodies, redactQueryKeys and heartbeatEnabled. In version 0.3.0 these are accepted but don't change behavior, so you can leave them out. The environment is set by the key you use, not by environment. In particular:

  • To turn off network capture, don't add the OkHttp adapter to your client.
  • Request and response bodies are never captured, and query strings are always removed from URLs, whatever these options are set to.

Next steps