onBreakTaken

fun onBreakTaken(ctx: Context, savedMillis: Long = 15 * 60_000L)(source)

Records when a user takes a break from scrolling.

This method should be called when the user either voluntarily takes a break or is forced to take one. It updates several metrics:

  1. Increments the daily break counter

  2. Adds to the total "avoided" scrolling time

  3. Updates the streak counter if breaks are taken on consecutive days

  4. Records the timestamp of the last break

Parameters

ctx

Application context for accessing SharedPreferences

savedMillis

Amount of time in milliseconds considered "saved" by this break (default: 15 minutes)

See also