Record away from the host and sync on reconnect

Configure native offline recording, retained sessions, and automatic or manual host transfer across Ansight mobile SDKs.

Native offline capture records app evidence on the device while the Ansight host is disconnected, then transfers retained sessions when the app reconnects. Swift and Kotlin own recording, storage, recovery, ZIP creation, and delivery. .NET/MAUI, React Native, Expo development builds, Flutter, and Capacitor use those same native engines on supported Apple and Android targets.

Availability: this implementation is on main after SDK 1.8.0 and requires the matching CLI host receiver. Use matching source builds until a release containing both is published. The published 1.8.0 packages provide the managed .NET recorder; they do not contain this native workflow.

Enable recording

Offline capture is opt-in. Add it to the options used by your existing runtime initialization. Enable Connectivity Capture alongside it to retain connection observations during a disconnected run.

.NET and MAUI

using Ansight;
using Ansight.Connectivity;
using Ansight.Native;

var options = Options.CreateBuilder()
    .WithConnectivityCapture()
    .WithOfflineCapture(new NativeOfflineCaptureOptions
    {
        MaximumSessions = 10,
        TransferMode = OfflineCaptureTransferMode.Automatic
    })
    .Build();

Runtime.InitializeAndActivate(options);

Add these options to the existing UseAnsight or initialization path when the app already configures Ansight. Do not create a parallel managed OfflineCaptureController in an app using native recording.

Swift

import AnsightCore

let options = try AnsightOptionsBuilder()
    .withConnectivityCapture()
    .withOfflineCapture(OfflineCaptureOptions(
        enabled: true,
        transferMode: .automatic,
        maximumSessions: 10
    ))
    .build()

Kotlin

import ai.ansight.runtime.AnsightOptionsBuilder
import ai.ansight.runtime.OfflineCaptureOptions
import ai.ansight.runtime.OfflineCaptureTransferMode

val options = AnsightOptionsBuilder()
    .withConnectivityCapture()
    .withOfflineCapture(OfflineCaptureOptions(
        enabled = true,
        transferMode = OfflineCaptureTransferMode.Automatic,
        maximumSessions = 10
    ))
    .build()

Calling the native builder’s withOfflineCapture() with no arguments enables recording. If you construct a Swift or Kotlin OfflineCaptureOptions object yourself, set enabled: true / enabled = true; the raw option object’s default is disabled.

React Native, Expo, and Capacitor

Use createOptionsBuilder from @ansight/react-native or @ansight/capacitor:

const options = createOptionsBuilder()
  .withConnectivityCapture()
  .withOfflineCapture({ maximumSessions: 10, transferMode: 'automatic' })
  .build();

Flutter

final options = AnsightOptionsBuilder()
    .withConnectivityCapture()
    .withOfflineCapture(const AnsightOfflineCaptureOptions(
      maximumSessions: 10,
      transferMode: 'automatic',
    ))
    .build();

Pass these options through the platform’s normal runtime initialization and activation. Framework HTTP wrappers keep recording while native status reports isOfflineCaptureRecording, subject to their existing network-capture opt-in.

Retention and lifecycle

SettingDefaultBehavior
maximumSessions10Includes the active recording; accepts any positive count.
maximumSessionBytes128 MiBRotates the recording when another record would exceed the payload budget.
maximumRetainedBytes512 MiBEvicts the oldest unleased sessions to bound retained payload bytes.
maximumQueuedBytes8 MiBBounds pending records and attachments.
transferModeautomaticTransfers retained sessions on an authenticated host reconnect. Use manual to require a request.
recordingEnabledtrueInitial app-controlled recording gate.
rootDirectoryApp-private storageCan be overridden to adopt an existing capture directory.

An active, eligible runtime can record before its first pairing. Connecting to the host seals the offline session; disconnecting starts another. Deactivation or revoking the recording gate seals recording and stops automatic transfers. Screenshots pause while the app is backgrounded.

Retention can evict untransferred sessions. In-flight transfer leases protect sessions until transfer completes or the lease is released. Byte budgets count payload files, excluding manifests, filesystem overhead, and the temporary transfer ZIP. Policy changes take effect at the next initialization; the recording gate can change while running.

For an app-controlled access policy in .NET, configure RecordingEnabled = false, initialize the runtime, then call await Runtime.SetOfflineCaptureEnabledAsync(userHasAnsightAccess) before activation. This gate is independent of configuring the feature.

Transfer and review

In automatic mode, reconnect the app to the matching host. The SDK sends each sealed archive over the authenticated app connection. The host verifies its size, checksum, archive paths, and app identity, imports the evidence, and persists it before acknowledging delivery.

The SDK deletes the local session only after a durable receipt with the matching source session ID and checksum. Interrupted transfers, older hosts, and invalid receipts retain the source for retry. Retrying an acknowledged import returns the same host session, including after a host restart.

For manual transfer, Swift and Kotlin expose transferOfflineCaptures(), and .NET exposes await Runtime.TransferOfflineCapturesAsync(). Agents can discover and invoke the offline_capture.transfer app tool when configured; that tool requires a write grant. A successful request means transfer started. Confirm completion by finding the imported session on the host.

ansight session list --json
ansight serve --open --session <imported-session-id>
ansight session connectivity <imported-session-id> summary --json

Imported IDs use offline-<source-session-id>. Review them alongside live captures in the player. See Connectivity Review for connection changes, quality samples, and annotation windows. Local-host transfer requires no cloud account or capture API key.

Evidence and compatibility

Recordings retain metadata, custom properties, metrics, events, client logs, touches, sanitized network requests, and configured screenshots and visual trees. Enabled connectivity observations travel through the application-event stream. Network bodies follow the configured capture and redaction policy.

The native stores can adopt prior managed sessions/<id> directories, including compact JSONL and existing manifest fields. They do not read encrypted ZIPs as a migration source or continue the managed cloud-upload workflow. Native capture currently has no offline annotated-feedback bundle sink and does not attach crash-report files to its ZIPs; crash reports retain their independent native outbox handoff.

Use Managed .NET Offline Capture for the existing controller, portable .NET recording, ZIP/AES export API, or separate cloud-upload integration. Keep one recorder responsible for an app’s offline session. Native recording and host-transfer tests cover the implemented behavior; physical-device and all-framework application smoke coverage remain release work.