DevConsole

object DevConsole

Functions

Link copied to clipboard
fun accessInfo(): AccessInfo?

Session-code credentials for the running server, or null when it is not running.

Link copied to clipboard
suspend fun captureScreenshot(): ScreenshotResult

Captures the foreground Activity's window and stores it as an attachment, then mirrors it onto the timeline. Safe to call from any dispatcher -- the capture path hops to the main thread only where the underlying platform APIs require it.

Link copied to clipboard
fun captureScreenshotAsync(callback: DevConsoleCallback<ScreenshotResult>)

Java-friendly counterpart to captureScreenshot; the callback is invoked on a background thread with a sealed result.

Link copied to clipboard

Creates the SDK-owned inspector intent after initialization; protected builds return null.

Link copied to clipboard
fun endpoint(): BrowserEndpoint?

Address of the running server, or null when it is not running. Survives activity recreation.

Link copied to clipboard

The current effective string value for a flag, for multi-valued flags declared with io.devconsole.state.FeatureFlag.ofOptions. Returns "" for an unknown key.

Link copied to clipboard

The current effective value for a flag declared in DevConsoleConfig.featureFlags.

Link copied to clipboard
fun initialize(application: Application, config: DevConsoleConfig = DevConsoleConfig.default()): InitResult

Prepares the SDK's capture engine, storage, and state/flag registries so network, WebSocket, push, and timeline recording are ready to receive events. This does not open a network port or start the browser dashboard -- that only happens on an explicit startBrowser / startBrowserAsync call.

Link copied to clipboard
fun logRecorder(): LogRecorder

Feed host log lines in so they join the timeline alongside network calls and crashes.

Link copied to clipboard
fun mockEngine(): MockEngine

Wrap in a DevConsoleMockInterceptor and add it to the host's own OkHttpClient.

Link copied to clipboard
fun networkRecorder(): NetworkTransactionRecorder

Wrap in a DevConsoleOkHttpInterceptor and add it to the host's own OkHttpClient.

Link copied to clipboard
fun open(context: Context): InspectorOpenResult

Opens the inspector from the host app's chosen trigger. With io.devconsole.api.OpenTriggers the SDK can also open it on a device shake or from a floating button -- both opt-in and off by default. The server is never started by any of these.

Link copied to clipboard
fun recordPush(input: PushInput): PushEvent

Called directly from the host's own push receiver. Never attempts provider delivery itself.

Link copied to clipboard
fun registerStateProvider(provider: StateProvider): Boolean

Registers a state provider after initialize, for features that are constructed lazily.

Link copied to clipboard
fun socketRecorder(): SocketRecorder

Wrap in a DevConsoleOkHttpWebSocketListener when opening the host's own WebSocket.

Link copied to clipboard
suspend fun startBrowser(request: StartRequest = StartRequest()): StartResult

Binds the embedded server and opens the browser dashboard. The SDK never does this on its own -- initialize only prepares capture/storage, so nothing is reachable over the network until a host calls this (or startBrowserAsync) explicitly, typically from a debug menu action, or unconditionally from onCreate if that suits the host.

Link copied to clipboard
fun startBrowserAsync(request: StartRequest = StartRequest(), callback: DevConsoleCallback<StartResult>)

Java-friendly counterpart to startBrowser; the callback is invoked on a background thread with a sealed result.

Link copied to clipboard
fun state(): StateFlow<DevConsoleState>
Link copied to clipboard
suspend fun stop(reason: StopReason = StopReason.UserRequested)
Link copied to clipboard
fun stopAsync(reason: StopReason = StopReason.UserRequested, callback: DevConsoleCallback<Unit> = DevConsoleCallback {})

Java-friendly counterpart to stop; the callback is invoked on a background thread when the stop attempt completes, whether or not it succeeded. Callers that need teardown to run unconditionally (e.g. releasing a foreground service pin) can rely on the callback firing even if provider's stop throws.