Touch Input

Capture app-local touch input with the Ansight .NET SDK so Ansight Studio can replay taps, drags, long presses, and cancelled gestures alongside screenshots and telemetry.

Touch input capture records where a user touches inside the app window while Ansight is active. Ansight Studio stores those records with the session so replay, timelines, heatmaps, and MCP touch-review tools can line up user input with screenshots, telemetry, logs, and visual-tree evidence.

Touch capture is disabled by default. Enable it only in local development, QA, or other controlled builds where input replay is useful.

Enable Touch Capture

For all-in-one setup, enable touch capture in the setup callback.

Standard .NET apps:

using Ansight;

var options = Options.CreateBuilder()
    .WithAnsightSdk(ansight =>
    {
        ansight.WithTouchCapture();
    })
    .Build();

Runtime.InitializeAndActivate(options);

.NET MAUI apps:

using Ansight.Maui;

builder.UseAnsight<App>(ansight =>
{
    ansight.WithTouchCapture();
});

For core-only setup:

using Ansight;

var options = Options.CreateBuilder()
    .WithTouchCapture()
    .Build();

Runtime.InitializeAndActivate(options);

WithTouchCapture() starts the platform capture session when Runtime.Activate() runs and stops it when Runtime.Deactivate() runs.

What Gets Captured

Each touch record includes:

  • action: down, move, up, or cancel
  • pointer id, pointer index, and pointer count
  • app-window coordinates
  • surface width, height, and scale when available
  • normalized coordinates when surface dimensions are known
  • UTC capture timestamp

Captured touches are streamed as input-capture records over an open host connection. They are not added to IDataSink, and they are separate from metric samples and Runtime.Event(...) timeline events.

Move Event Throttling

Move capture can be noisy during scrolling, dragging, and multi-touch gestures. The default settings keep move events useful without recording every platform callback:

var options = Options.CreateBuilder()
    .WithTouchCapture(
        captureMoveEvents: true,
        captureCancelEvents: true,
        moveCaptureDistanceThreshold: 4,
        moveCaptureFramesPerSecond: 15)
    .Build();
OptionMeaningDefault
captureMoveEventsInclude move events in addition to down/up events.true
captureCancelEventsInclude platform cancellation events.true
moveCaptureDistanceThresholdMinimum movement in logical display units before another move event is captured for a pointer. Use 0 to disable distance filtering.4
moveCaptureFramesPerSecondMaximum move event cadence per pointer. Use 0 to disable FPS filtering.15

To capture only taps and release points:

var options = Options.CreateBuilder()
    .WithTouchCapture(captureMoveEvents: false)
    .Build();

Disable touch capture explicitly with WithoutTouchCapture().

Platform Support

Touch capture currently has platform sessions for:

  • Android
  • iOS
  • Mac Catalyst

Other .NET targets accept the option but do not emit touch records.

Pair With Screenshots

Touch input is most useful when the session also has visual context. The all-in-one packages already enable session JPEG capture every 2000ms at quality 60 with max width 480.

For core-only apps, add session capture when you want replay evidence:

var options = Options.CreateBuilder()
    .WithTouchCapture()
    .WithSessionJpegCapture(intervalMilliseconds: 2000, quality: 60, maxWidth: 480)
    .Build();

See JPEG Screenshots for screenshot configuration.

Performance And Privacy

Touch records can reveal user behavior, typed paths through the UI, and sensitive screen locations. Keep touch capture out of protected Release, TestFlight, App Store, Play Store, and other distributable builds unless it is explicitly approved.

For touch-heavy screens, prefer the default move throttling or disable move events. A capture focused on tap targets usually needs down/up events and screenshots more than every move sample.