About this project

# TelemetryDeck Kotlin SDK A Kotlin library for sending analytics signals from Android applications to [TelemetryDeck](https://telemetrydeck.com), a privacy-first analytics platform. The SDK runs on Android API 23+ with Kotlin 2.3.x. ## Core Capabilities **Signal Sending** — Call `TelemetryDeck.send("eventName")` to fire an analytics signal immediately, or use `TelemetryDeck.signal("eventName")` to enqueue it for later transmission. **Session Tracking** — Automatically detects new installs, measures session duration, and computes retention metrics (average session seconds, distinct days used, total session count). Session state is stored locally on device and cleared on uninstall. **User Identity** — Generates a device-scoped anonymous identifier by default. Supports custom user identifiers via `defaultUser` (hashed before sending) or a custom `TelemetryDeckIdentityProvider` implementation. **Environment Parameters** — Enriches every signal automatically with device metadata (model, OS, screen resolution, orientation, architecture, brand, time zone), app metadata (version, build number), and SDK metadata. Also captures accessibility settings (font scale mapped to iOS size categories, bold text, color inversion, reduce motion, dark/light scheme). **Navigation Signals** — Track user flow between screens with `TelemetryDeck.navigate(source, destination)` or call it at each path change for automatic route tracking. **Duration Tracking** — Start and stop named duration signals (`startDurationSignal` / `stopAndSendDurationSignal`) to measure time spent on specific events like wizard steps. **Acquisition Helpers** — Convenience methods for `acquiredUser(channel)`, `leadStarted(leadId)`, and `leadConverted(leadId)`. **Calendar Parameters** — Appends day-of-week, day-of-month, week-of-year, quarter, hour-of-day, weekend flag, and more to every outgoing signal. **Purchase Tracking** — `purchaseCompleted()` records in-app purchases with marketplace country code and product ID. **In-Memory-Only Mode** — Call `inMemoryOnly(true)` on the builder to run without writing to disk, suitable for sandboxed processes. User identity is regenerated on each launch; new-install detection and retention metrics are unavailable in this mode. ## Installation Add to `build.gradle`: ```groovy implementation 'com.telemetrydeck:kotlin-sdk:7.2.0' ``` Add internet permission to `AndroidManifest.xml`: ```xml <uses-permission android:name="android.permission.INTERNET" /> ``` Configure via manifest meta-data or programmatic builder: ```kotlin val builder = TelemetryDeck.Builder() .appID("YOUR-APP-ID") .showDebugLogs(true) .defaultUser("anonymous-user") TelemetryDeck.start(applicationContext, builder) ``` ## Providers & Customization The SDK uses a provider plugin system. Built-in providers include `EnvironmentParameterProvider`, `PlatformContextProvider`, `AccessibilityProvider`, `SessionTrackingSignalProvider`, and `CalendarParameterProvider`. Custom enrichment can be added via `DefaultParameterProvider`, `DefaultPrefixProvider`, or by implementing `TelemetryDeckIdentityProvider`, `TelemetryDeckSessionManagerProvider`, and `TelemetryDeckStorage` for custom backends.