Nx10 Logo
Docs

3. Telemetry Collection

Control high-resolution touch, motion, typing, and screen-state capture.

Starting and Stopping Capture

Telemetry does not start on its own. Start it after startSession(enableDemo:) has succeeded so the SDK has its project configuration and routing endpoints.

You can stop telemetry to conserve battery, prevent collection during sensitive flows, or flush pending data before the app backgrounds. Calling stopTelemetry() flushes pending data for you.

Telemetry captures interaction signals, not content. nx10 can see patterns such as touch timing, device motion, keypress cadence, corrections, and deletions; it does not know what the user is looking at, what they are doing in the app, or the words they type.

Zero Instrumentation

If you use NX10MESceneDelegate, the SDK installs the touch-interceptor window for you. No manual touch forwarding is required inside normal app scenes.

TelemetryStartup.swift
NX10Core.shared.telemetry.stopTelemetry()
NX10Core.shared.telemetry.startTelemetry()

Lifecycle Control

Stop capture when your app moves into the background, or when a specific view dismisses.

ContentView.swift
import SwiftUI
import NX10CoreSDK

struct ContentView: View {
    @Environment(.scenePhase) private var scenePhase

    var body: some View {
        VStack {
            Text("Your app content")
        }
        .onChange(of: scenePhase) { newPhase in
            if newPhase == .background {
                NX10Core.shared.telemetry.stopTelemetry()
            }
        }
    }
}

Manual Telemetry

Keyboard extensions and custom input surfaces can report typing signals directly through the telemetry API. Touch capture has two integration paths, covered in the selector below.

KeyboardSignals.swift
NX10Core.shared.telemetry.keyPressed("a")
NX10Core.shared.telemetry.keyReleased("a")
NX10Core.shared.telemetry.keyboardDidShow()
NX10Core.shared.telemetry.keyboardDidHide()
NX10Core.shared.telemetry.backspacePressed(erasedCharacterCount: 3)
NX10Core.shared.telemetry.textCorrected(.autocorrect)

What does the SDK capture?

  • General Touch Events: touch phase, coordinates, force, and movement.
  • Device Motion: accelerometer, gyroscope, and magnetometer data.
  • Keyboard Signals: keypresses, releases, corrections, deletions, and visibility without the typed characters or message body.
  • Screen State: lock state, unlock state, orientation, and brightness.
  • Not Captured: screenshots, screen recordings, view contents, passwords, or text field contents.

Networking and Flushing

Networking is controlled by consent. If networking is disabled whenflushIfNeeded() or attemptUploadAndFlushNow() runs, the upload is skipped and the buffered telemetry is discarded rather than queued for retry.

The telemetry pipeline is built to keep runtime overhead low. The SDK batches samples, compresses payloads, and performs upload work away from the main interaction path so high-frequency signals do not become a UI, memory, battery, or network problem.

TelemetryFlush.swift
NX10Core.shared.consent.allowDataCollection = true
NX10Core.shared.telemetry.flushIfNeeded()
NX10Core.shared.telemetry.attemptUploadAndFlushNow()

Performance and Memory Footprint

To keep memory footprint low, nx10 accumulates samples into batches, compresses them, and flushes at controlled points rather than handling each one individually.

Processing and upload work are designed to run concurrently with the app experience instead of blocking user interaction. This keeps the main thread focused on UIKit and SwiftUI rendering while telemetry storage, compression, and transport work happen in the background.

Batching

Samples are grouped before storage and upload, reducing per-event overhead.

Compression

Payloads are compacted before transport to reduce bandwidth and battery cost.

Concurrency

Storage, compression, and upload work are kept off the main interaction path.

Touch Capture Modes

Touch telemetry should be wired through one capture path per surface. Use the scene delegate path for full-screen app capture, or manual touch forwarding for contexts that do not have that scene lifecycle.

Full-Screen Touches

If you want all touches captured, the preferred integration is to opt in by subclassing NX10MESceneDelegate. The SDK installs its TouchEventInterceptor window as the scene window and observes every touch that flows through the app surface.

The interceptor calls super.sendEvent(_ event:) first, so normal UIKit and SwiftUI responders still receive touches before nx10 processes the telemetry sample. This makes it the right choice for whole-app coverage where you do not need custom touch extraction logic.

Full-screen capture still only records touch telemetry. It does not inspect the view hierarchy, capture pixels, read labels, or infer what a user is doing from screen content.

SceneDelegate.swift
import SwiftUI
import NX10CoreSDK

class SceneDelegate: NX10MESceneDelegate {
    override var contentView: AnyView {
        AnyView(ContentView())
    }
}
Use This For
  • Normal UIKit and SwiftUI app screens.
  • Whole-app touch coverage from one scene delegate.
  • Apps that want telemetry without custom touch plumbing.
Do Not Use With
  • Manual forwarding for the same UITouch events.
  • A second custom window that also reports the same touches.
  • Keyboard extensions, which do not use the app scene lifecycle.