-
public final class EventReporterFire-and-forget device lifecycle event reporter. Pure Kotlin (no Android types) so the batching/dedup/ring-buffer logic is unit-testable with fakes.
Rules (identical to the browser SDK): never throws, never blocks the caller; flush when 20 events are queued, every 10s, or immediately on error/fatal; dedup identical type+code within 30s into a
data.repeatcount; cap 200 events per session; monotonicseq; failed batches persist to the ring buffer and are drained on the next boot.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classEventReporter.Companion
-
Constructor Summary
Constructors Constructor Description EventReporter(EventContext context, EventTransport transport, EventStorage storage, CoroutineScope scope, Boolean enabled, Function0<Long> clock, Boolean startTimer)
-
Method Summary
Modifier and Type Method Description final UnitsetSessionKey(String key)final Unitreport(EventType type, String code, String message, String modelId, String modelVersion, String taskType, Long durationMs, Long bytes, JsonObject data)final Unitflush()Snapshot a batch and post it off the caller's thread. final UnitflushBeforeStop()Flush on a non-cancellable context — used at ON_STOP, before scope.cancel(). -
-
Constructor Detail
-
EventReporter
EventReporter(EventContext context, EventTransport transport, EventStorage storage, CoroutineScope scope, Boolean enabled, Function0<Long> clock, Boolean startTimer)
-
-
Method Detail
-
setSessionKey
final Unit setSessionKey(String key)
-
report
final Unit report(EventType type, String code, String message, String modelId, String modelVersion, String taskType, Long durationMs, Long bytes, JsonObject data)
-
flushBeforeStop
final Unit flushBeforeStop()
Flush on a non-cancellable context — used at ON_STOP, before scope.cancel().
-
-
-
-