Dari

Configuration

DariConfig options and the runtime Dari API

Pass a DariConfig instance to Dari.init() to customize behavior before or during app startup.

// import kotlin.time.Duration.Companion.days
// import kotlin.time.Duration.Companion.hours
Dari.init(
    context = this,
    config = DariConfig(
        maxEntries = 500,
        showNotification = true,
        maxContentLength = 500_000,
        shakeToOpen = false,
        retentionPeriod = 1.days,
        fireAndForget = false,
    )
)

Options

maxEntries

Type: Int | Default: 500

Maximum number of messages to keep in memory. Oldest entries are evicted when the limit is exceeded.

showNotification

Type: Boolean | Default: true

Shows a persistent status notification. Tap it to open the inspector.

maxContentLength

Type: Int | Default: 500_000

Maximum character length for request/response body data. Longer bodies are truncated.

shakeToOpen

Type: Boolean | Default: false

Opens the Dari inspector screen when the device is shaken.

retentionPeriod

Type: Duration? | Default: null

TTL-based cleanup deletes messages older than this duration automatically.

// import kotlin.time.Duration.Companion.hours
DariConfig(retentionPeriod = 6.hours)

null disables TTL cleanup.

fireAndForget

Type: Boolean | Default: false

When true, all bridge calls are resolved to SUCCESS immediately without waiting for a response. Useful when your entire bridge is one-way.

For per-call control, pass fireAndForget directly to the interceptor methods.

Runtime API

Call these on Dari at any time after initialization. In dari-noop they do nothing.

MethodDescription
init(context, config)Initialize with a custom DariConfig
createInterceptor(tag?)Create a DariInterceptor with an optional tag. Returns null in noop
createInterceptor(tag?, protobufDecoder)Create a protobuf-capable interceptor; see Protocol Buffers
setProtobufDecoder(decoder)Protobuf decoder for interceptors the Gradle plugin creates. Call once at app start
setShakeToOpenEnabled(enabled)Turn shake-to-open on or off. Persisted
setDarkMode(value)true / false, or null for the system theme. Persisted
setShowTagChip(show)Show or hide tag chips in the message list. Persisted
setJsonFoldingEnabled(enabled)Show or hide fold controls for nested JSON. Persisted
setMaskingEnabled(enabled)Mask sensitive values in the in-app screens and exports; see Masking. Persisted
setPayloadRedactor(redactor)Rewrite or hide messages before they reach the desktop app
setDesktopInspectorEnabled(enabled)Allow the desktop app to connect over adb. On by default in debuggable builds
setEnvironment(labels)Label the capture (region, web build, flavor, …). Shown in both inspectors and exports; replaces earlier labels. Not persisted
showNotification()Show the notification, e.g. after the permission is granted
clear()Clear all stored messages and dismiss the notification

On this page