Configuration

Configure Cordova/Capacitor sampling, capture, lifecycle, pairing, properties, DOM tools, native suites, and tool guards.

Use an AnsightOptions object or the builder:

const options = Ansight.createOptionsBuilder()
  .withAnsightDefaults()
  .withReadOnlyToolAccess()
  .withSessionJpegCapture({
    intervalMilliseconds: 2000,
    quality: 60,
    maxWidth: 480,
  })
  .withTouchCapture()
  .withDomTools({
    includeHidden: false,
    includeText: true,
    maxDepth: 30,
    maxNodes: 1500,
    allowActions: false,
  })
  .withErrorCapture()
  .build();

.withAnsightDefaults() selects native all-in-one defaults, 400 ms sampling, 120 s retention, FPS, JPEG capture, touch capture, read-only tools, and host auto-probe.

Use .withRemoteTools(...) or suite helpers for native visual-tree, file-system, database, preferences, and reflection tools. Secure storage is configured through .withSecureStorage(...) or remoteTools.secureStorage.

Diagnostic and Capture Options

Option or builder methodPurpose
enableOpenFileHandleTracking / withOpenFileHandleTracking()Sample native process open-file-handle count on channel 7. Defaults to false.
enableJniReferenceCountTracking / withJniReferenceCountTracking()Sample JNI global references on Android channel 6. Defaults to false.
sessionJpegCapture.modescreenshotOnly, screenshotAndVisualTree, or screenshotWithVisualTreeOnTouch.
sessionJpegCapture.captureKeyboardPresenceRecord keyboard presence only. Defaults to false.
crashCapture / withCrashCapture(...)Configure durable native crash capture. Enabled by default.
withoutCrashCapture()Disable the app-private crash outbox.

See JPEG Screenshots and Crash Capture for the complete behavior.

Cellular Host Connections

Cellular connections are rejected by default for QR enrollment, saved profiles, and explicit connections. Opt in only for an intentional mobile-data or personal-hotspot workflow:

const options = Ansight.createOptionsBuilder()
  .withCellularHostConnections()
  .build();

This can consume mobile data and does not change the clear-text local-development transport.

Crash Capture

const options = Ansight.createOptionsBuilder()
  .withCrashCapture({
    studioHandoffEnabled: true,
    offlineCaptureAttachmentEnabled: true,
    maximumPendingReports: 8,
    retentionDays: 7,
    maximumBreadcrumbs: 64,
    maximumTraceBytes: 1_048_576,
  })
  .build();

Use withoutCrashCapture() when the app must not persist crash evidence.