API Reference

This page covers the main public entry points used during setup.

Android

Start

Call from your launcher Activity:

Snapbug.start(this)

All plugins are enabled by default: network, database, analytics, crash reporter, device info, deep links, logs, and the debug feedback overlay.

Start with configuration

Snapbug.start(this) {
    overlay = OverlayMode.BUBBLE   // BUBBLE (default), FAB, or NONE
    crashReporter { catchFatalErrors = true }
    debugFeedback { screenNameProvider = { "Home" } }
    network = false                // disable an individual plugin
}

Runtime connection updates

Snapbug.instance?.updateServerHost("192.168.1.10")
Snapbug.instance?.updateRelay(
    relayHost = "relay.snapbug.ai",
    roomCode = "123456"
)

Connection state

The SDK exposes Snapbug.instance?.connectionState (a StateFlow<SnapbugConnectionState>) with:

  • Disconnected
  • Connecting
  • Connected(viaRelay, viaWebRtc)
  • Error(message)

iOS

Start

import Snapbug
 
Snapbug.start()

Call once in your App struct's init() or in application(_:didFinishLaunchingWithOptions:). This installs the DebugFeedback, Analytics, CrashReporter, Device, Network, and Logs plugins and starts the overlay.

Start with configuration

Snapbug.start(config: .init(
    serverHost: "192.168.1.10",
    screenNameProvider: { "Home" },
    catchFatalErrors: true
))

Flutter

The native SDK must already be initialized (Snapbug.start(this) on Android, Snapbug.start() in the iOS AppDelegate); the Dart call connects the Dart plugins to that native bridge.

Start

await Snapbug.start();

Default plugins: SnapbugNetwork, SnapbugAnalytics, SnapbugCrashReporter, SnapbugLogs.

Start with explicit plugins

await Snapbug.start(
  plugins: [SnapbugNetwork()],
);

Logs zone hook

On iOS, forward plain print() calls by wrapping your app in a zone (see Flutter):

runZonedGuarded(() async {
  await Snapbug.start();
  runApp(const MyApp());
}, (error, stack) {
  SnapbugCrashReporter.reportError(error, stack);
}, zoneSpecification: SnapbugLogs.zoneSpecification());

Bridge helpers

await Snapbug.sendMessage(
  plugin: "network",
  method: "request",
  body: "{}",
);
 
await Snapbug.updateServerHost("192.168.1.10");

React Native

The native SDK must already be initialized in your Android Application / iOS AppDelegate; the JS call connects the JS plugins to that native bridge.

Start

Snapbug.start();

Default plugins: SnapbugNetwork, SnapbugAnalytics, SnapbugCrashReporter, SnapbugLogs (on iOS the logs plugin hooks console.log/info/warn/error/debug).

Start with explicit plugins

Snapbug.start({
  plugins: [new SnapbugNetwork()],
});

Bridge helpers

Snapbug.sendMessage("network", "request", "{}");
Snapbug.updateServerHost("192.168.1.10");

Notes

  • The preferred user-facing transport is the Chrome Extension room-code flow.
  • updateServerHost(...) is mainly for direct localhost or custom host-based connections (including the desktop app transport).
  • The local service is optional and adds AI workflows on top of the main inspection flow.