# App usage

An action block that gets usage statistics for an app, or all apps, within an interval.

The fiber will proceed immediately without pause.

This block gets the app usage statistics as recorded and stored by the system. Usage statistics are aggregated into day, week, month and year intervals, the minimum timestamp and maximum timestamp determines which interval period to output. The system only keep a few past intervals, so don’t expect to access 12 daily statistics from 4 years ago.

Note! This feature requires Android 5+.

## Input arguments

- Minimum timestamp — unix timestamp of the earliest usage statistics to get, default is first recorded usage.
- Maximum timestamp — unix timestamp of the latest usage statistics to get, default is current time.
- Interval — interval to output aggregated usage statistics for, default is Best fit.
- Package — package name of the app to output usage statistics for, default is for all apps.
- Statistic — type of usage statistic to output, default is Foreground.

## Output variables

- Usage duration — variable to assign the total duration in the statistic state, in seconds.
- Last used — variable to assign the last time in the statistic was triggered, as a unix timestamp, may be outside of the specified time window due to an Android bug.
- Stats start — variable to assign the first reported statistic, as unix timestamp, may be outside of the specified time window if it’s not exactly fitting an aggregation interval.
- Stats end — variable to assign the last reported statistic, as unix timestamp, may be outside of the specified time window if it’s not exactly fitting an aggregation interval.