endSession

fun endSession(ctx: Context, endAt: Long = System.currentTimeMillis())(source)

Ends the current scrolling session and saves the duration.

This method should be called when the user stops scrolling or switches to a different app. It calculates the session duration and updates both the per-app and total scroll times for the current day in SharedPreferences.

Parameters

ctx

Application context for accessing SharedPreferences

endAt

Timestamp when the session ended (defaults to current time)

See also