Duration KPI (v5.5+)

The SDK provides a way to create a "duration kpi" to record the duration from time A to time B

The main use case is to record the time spent on a view

Start the timer in onResume

override fun onResume() {
    super.onResume()
    APStatsManager.startDurationKpi("your_screen")
}

You can optionally provide a context param, which is a Map<String, Any>

APStatsManager.startDurationKpi("your_screen", context = mapOf("user_id" to 5))

And end the timer in onPause

override fun onPause() {
    super.onPause()
    APStatsManager.endDurationKpi("kotlin_activity")
}