Record connection changes alongside app behavior

Enable passive connectivity capture across Ansight SDKs, understand platform measurements, and retain connection changes in offline .NET captures.

Connectivity capture records the operating system’s view of the device’s connection: availability, active transports, connection changes, and supported link-quality estimates. Use it to see whether a failed request or stalled screen coincided with a disconnect, reconnect, or switch between Wi-Fi and cellular.

Collection is opt-in and independent of both HTTP request capture and the app’s connection to the Ansight host. An available connection does not prove that the internet or your application server is reachable.

Enable collection

Add connectivity to the options builder used by your existing SDK initialization. The all-in-one packages include the feature, but do not enable it automatically.

.NET and MAUI

Ansight.Connectivity is included by Ansight and Ansight.Maui. For a core-only integration, add it explicitly:

dotnet add package Ansight.Connectivity
using Ansight;
using Ansight.Connectivity;

var options = Options.CreateBuilder()
    .WithConnectivityCapture(capture =>
        capture.MinimumSampleIntervalMilliseconds = 5_000)
    .Build();

Runtime.InitializeAndActivate(options);

For an app that already initializes Ansight, add WithConnectivityCapture(...) to that configuration instead of initializing a second runtime. Omit the extension to leave collection disabled.

iOS and Apple targets

The native product is AnsightConnectivity for Swift Package Manager or CocoaPods, also included by Ansight:

import AnsightConnectivity

let options = try AnsightOptionsBuilder()
    .withConnectivityCapture(
        AnsightConnectivityCaptureOptions(minimumSampleIntervalMilliseconds: 5_000)
    )
    .build()

Pass these options to the existing native runtime initialization.

Android

The native artifact is ai.ansight:ansight-connectivity-android, also included by ai.ansight:ansight-android. For a modular integration:

implementation("ai.ansight:ansight-connectivity-android:latest.release")
import ai.ansight.runtime.AnsightConnectivityCaptureOptions
import ai.ansight.runtime.AnsightOptionsBuilder

val options = AnsightOptionsBuilder()
    .withConnectivityCapture(
        AnsightConnectivityCaptureOptions(minimumSampleIntervalMilliseconds = 5_000)
    )
    .build()

React Native, Expo, and Capacitor

The React Native and Capacitor packages expose the same builder call. Import createOptionsBuilder from @ansight/react-native or @ansight/capacitor in the app’s existing bootstrap:

const options = createOptionsBuilder()
  .withConnectivityCapture({ minimumSampleIntervalMilliseconds: 5000 })
  .build();

Expo requires a native development build with the React Native SDK installed. Collection uses the underlying Apple or Android observer.

Flutter

import 'package:ansight_flutter/ansight_flutter.dart';

final options = AnsightOptionsBuilder()
    .withConnectivityCapture(const AnsightConnectivityCaptureOptions(
      minimumSampleIntervalMilliseconds: 5000,
    ))
    .build();

Swift, Kotlin, JavaScript, and Dart builders also expose withoutConnectivityCapture().

Sampling and lifecycle

The minimum interval defaults to 5 seconds and is clamped to 1–300 seconds. It limits quality-only updates; connection-state changes are emitted immediately. It does not schedule active speed tests or guarantee a new quality measurement every interval.

Collection follows runtime activation. Native mobile observers pause when the app backgrounds, recording a gap, and emit a fresh snapshot on foregrounding. A gap means observation was interrupted; it is not evidence that the device lost its connection.

Platform measurements

Missing fields mean unknown, not false or zero. The native observers supply the same measurements through the .NET, React Native, Flutter, and Capacitor mobile bridges.

MeasurementAppleAndroidPortable .NET desktop
Availability and active transportsNWPathMonitorDefault-network callbacks, with a broadcast fallback on older OS versionsAvailability only; default-route transport unknown
VPNUnknownOS transport flagUnknown
Internet validation and captive portalUnknownOS capabilities on API 23+Unknown
Metered / expensive connectionExpensive flagMetered capabilityUnknown
Low Data ModeConstrained flagUnknown; Data Saver is not equivalentUnknown
Link qualityOS estimate on iOS/macOS 26+UnknownUnknown
Signal and estimated bandwidthUnknownValues when exposed by the OS; signal on API 29+Unknown

Bandwidth estimates use kbps. Android signal values retain the bearer-specific unit because the OS API does not supply one universal scale. Quality values include their source and measurement time, so playback can show their age. These are passive estimates, not throughput or latency measurements.

Retain connectivity without a host

Enable Native Offline Capture separately to retain application events, including connectivity observations, across native and framework SDKs and transfer them on reconnect. This implementation is on main after 1.8.0 and requires the matching host receiver.

For the managed recorder available in the 1.8.0 packages, enable connectivity before starting .NET Offline Capture. That recorder includes the last known observation at capture start, keeping its original timestamp.

Managed offline archives and host streamable exports contain connectivity/index.json and connectivity/segments/000001.jsonl with ansight.connectivity.v1 observations. Record kinds are snapshot, change, quality, and gap. Each contains complete connection state; a change also carries the previous state. Segments and retained windows preserve the preceding observation so playback can establish the state at a boundary. Queue overflow records a gap, and the offline manifest reports dropped records.

No connectivity index is written when nothing was captured. Existing archives without connectivity remain readable. Import, export, and focused extraction preserve connectivity alongside the other session evidence.

Inspect a capture

Open the player’s Connectivity tab or query a live or imported session:

ansight session connectivity <session-id> summary --json
ansight session connectivity <session-id> at --offset 01:15 --json
ansight session connectivity <session-id> events --from 00:30 --to 02:00 --json

See Connectivity Review for the timeline, quality charts, annotation windows, pagination, and agent tools.

Privacy

The collector performs no pings, speed tests, DNS requests, Wi-Fi scans, or permission prompts. It collects no SSIDs, BSSIDs, IP addresses, carrier names, or network identifiers. HTTP capture has its own configuration and data-handling policy.