usage_stats library
Query Android usage statistics — app usage, events, configuration changes,
app standby buckets, storage usage and per-app network data — by wrapping
Android's UsageStatsManager, NetworkStatsManager, StorageStatsManager
and PackageManager behind a single UsageStats facade.
This package is Android-only. Most queries require the special
PACKAGE_USAGE_STATS permission, which the user grants from system
settings via UsageStats.grantUsagePermission.
Classes
- AppInfo
-
Metadata about an installed application, resolved via
PackageManager. - ConfigurationInfo
- Statistics about how long a given device configuration was active.
- EventInfo
- Aggregated statistics for a single event type over an interval.
- EventUsageInfo
- A single usage event emitted by the system, such as an activity moving to the foreground or a notification being shown.
- NetworkInfo
- Per-app network usage (bytes received and transmitted).
- StorageInfo
- On-device storage usage for a single app package.
- UsageInfo
- Aggregated foreground-usage statistics for a single app package.
- UsageStats
- Entry point for all usage-statistics queries. All methods are static.
Enums
- IntervalType
-
The interval granularity used by UsageStats.queryUsageStats and
UsageStats.queryEventStats. Mirrors
UsageStatsManager.INTERVAL_*. - NetworkType
- The transport to aggregate when querying network usage.
Extensions
- IntervalTypeValue on IntervalType
- Maps IntervalType to the integer expected by the platform channel.
- NetworkTypeExt on NetworkType
- Maps NetworkType to the integer expected by the platform channel.