Configuration

Configure React Native sampling, memory profiling, screenshots, touch capture, lifecycle tracking, pairing, custom properties, native tools, and tool guards.

Configure the bridge with an AnsightOptions object or Ansight.createOptionsBuilder().

const options = Ansight.createOptionsBuilder()
  .withNativeAllInOneDefaults()
  .withReadOnlyToolAccess()
  .withBatteryLevel()
  .registerCustomProperty("app", "region", "au")
  .build();

await Ansight.initializeAndActivate(options);

Option Surface

OptionPurpose
useNativeAllInOneDefaultsApplies native iOS/Android all-in-one defaults when true. Defaults to false. This is not a master enable switch; configure toolGuard, capture options, and hostConnection separately.
clientNameDefault client name for host auto-probe and connection calls.
sampleFrequencyMillisecondsBuilt-in telemetry cadence.
retentionPeriodSecondsLocal metric/event retention.
enableFramesPerSecondNative FPS sampling.
enableBatteryLevelNative battery sampling where supported.
defaultMemoryChannelsBuilt-in native memory channels.
reactNativeMemoryReact Native JS heap used/total profiling; set false to disable.
additionalChannelsApp-defined metric channels.
sessionJpegCaptureObject to enable/configure capture, or false to disable. Supports captureGpuBackedSurfaces; on iOS it defaults to true for Metal, SceneKit, and similar GPU-backed views.
touchCaptureObject to enable/configure touch capture, or false to disable.
lifecycleCaptureNative lifecycle and screen-view capture options.
toolGuard"disabled", "readOnly", "readWrite", or "fullAccess".
customPropertiesGrouped string properties sent with session.open.
hostAutoProbeBackground reconnect settings.
hostConnectionSaved, bundled, and developer pairing settings.
remoteToolsNative visual tree, file, database, preferences, reflection, and secure-storage tool options.
lifecycleJavaScript AppState tracking toggle. Defaults to true.

Builder Methods

MethodPurpose
withNativeAllInOneDefaults() / withAnsightDefaults() / withAnsightSdk(...)Apply native all-in-one defaults. withNativeAllInOneDefaults() and withAnsightDefaults() use read-only tool access; withAnsightSdk(...) opts into full all-in-one access.
withSampleFrequencyMilliseconds(...)Set sampling cadence.
withFramesPerSecond() / withoutFramesPerSecond()Toggle FPS sampling.
withBatteryLevel() / withoutBatteryLevel()Toggle battery sampling.
withRetentionPeriodSeconds(...)Set retained telemetry window.
withDefaultMemoryChannels(...) / withoutDefaultMemoryChannels(...)Configure native memory channels.
withReactNativeMemoryProfiling(...) / withoutReactNativeMemoryProfiling()Configure RN JS heap channels.
withSessionJpegCapture(...) / withoutSessionJpegCapture()Configure live JPEG frame capture, including captureGpuBackedSurfaces.
withTouchCapture(...) / withoutTouchCapture()Configure touch capture.
withLifecycleCapture(...)Configure native lifecycle capture.
withToolGuard(...) and guard presetsConfigure remote-tool discovery and execution.
withHostAutoProbe(...) / withoutHostAutoProbe()Configure automatic reconnect probing.
withHostConnection(...) / withBundledHostConnection(...)Configure pairing sources.
withRemoteTools(...) and tool-specific helpersConfigure native tool suites.
withVisualTreeTools() / withoutVisualTreeTools()Opt in or out of native VisualTree tools.

Host Auto-Probe

hostAutoProbe forwards to the native iOS/Android remembered-host retry behavior. When enabled, it retries previous host connections so the app can reconnect after the host disappears and later reappears.

await Ansight.initializeAndActivate({
  hostAutoProbe: {
    enabled: true,
    initialDelayMilliseconds: 1000,
    probeIntervalMilliseconds: 5000,
    reconnectDelayMilliseconds: 10000,
    clientName: "React Native App",
  },
});

Use withoutHostAutoProbe() or hostAutoProbe: { enabled: false } when reconnects should only happen after an explicit app action.

Memory Profiling

await Ansight.initializeAndActivate({
  reactNativeMemory: {
    enabled: true,
    jsHeapUsed: true,
    jsHeapTotal: true,
  },
});

Set reactNativeMemory: false to disable RN JS heap profiling.

Important: Screen capture will result in an FPS drop while native frames are captured, encoded, and transported. Disable sessionJpegCapture for performance-focused runs unless visual evidence is required.