Recording

Methods for capturing data from your running app. All are fire-and-forget on a background dispatcher.

recordEvent(name, properties?)

Record a named event with optional key-value properties. Appears in the Events timeline.

recordError(throwable, place?)

Record a caught exception. Swift: recordError(reason, stackTrace?, place?). Uncaught exceptions are captured automatically via the crash handler.

recordTraffic(status, url, method, ...)

Manually record a network request for clients Alohomora doesn't auto-capture. Use OkHttp/Ktor interceptors instead when possible.

recordSpan(traceId, spanId, ...)

Record a distributed trace span. Short form: recordSpan(name, durationNanos). See Traces for adapters.

recordFeatureFlag(key, value, ...)

Record a single feature flag with source, type, and metadata. Batch: setFeatureFlags(flags, source?).

registerAppDatabase(name, path?)

Register an app database for live inspection in the Database panel. Supports Room and raw SQLite.

excludeAppDatabase(name)

Exclude a database from inspection. Useful for internal databases you don't want cluttering the panel.

clearAppDatabaseOverrides()

Clear all database registration overrides, reverting to auto-discovered databases.

setShakeToOpenEnabled(enabled)

Toggle shake-to-open for the in-app console. Default: on.

Infrastructure

Lifecycle, server, and replay handler management.

init()

Initialize Alohomora. Android auto-initializes via AndroidX Startup and needs no call. iOS requires manual: Alohomora.shared.doInit() in Swift.

startDevToolsServer(port?)

Start the TCP server for the desktop companion. Default port: 53999. Called automatically on Android; call manually on iOS.

stopDevToolsServer()

Stop the TCP server and drop the active connection.

registerReplayHandler(handler)

Register a handler for traffic replay. See Traffic Replay for OkHttp, Ktor, and custom handlers.

clearReplayHandler()

Remove the registered replay handler. The replay action disappears from both consoles.

isReplaySupported

true if a replay handler is registered. Always false in the noop artifact.

Plugins

Embed custom Compose screens into Alohomora's navigation via CustomScreenPlugin.

registerPlugin(plugin)

Register a CustomScreenPlugin to add a custom tab to the console. The plugin provides an ID, display name, icon, and a @Composable content block.

unregisterPlugin(pluginId)

Remove a plugin by its ID. The tab disappears from navigation.

getPlugins()

Returns the list of currently registered plugins.


Replay Configuration

Fine-tune replay behaviour for apps with custom authentication or signing headers.

ReplayHeaders.additionalStripList

Set of header names to strip before replay. Add custom signature or auth headers here so your interceptors regenerate them. Content-Length, Host, and [REDACTED] values are always stripped.

Kotlin
// Strip custom signature headers before replay
ReplayHeaders.additionalStripList = setOf(
    "X-Signature",
    "X-Request-Id",
    "X-Timestamp"
)