1# Device Usage Statistics Overview
2
3Device usage statistics include the usage of applications, notifications, and the system. Currently, you can use device usage statistics APIs to access only statistics on the application usage. In application usage statistics, you can query the application usage, event logs, and bundle groups.
4
5The application records (usage history statistics and event records) cached by components are flushed to the database for persistent storage within 30 minutes after an event is reported.
6
7## Introduction
8
9The application usage statistics are flushed:
10- Every 30 minutes.
11- Upon system time changes.
12- Upon start of a new day.
13
14You can use **query()** (including **isIdleState**) to obtain:
15- Events of all applications based on the specified start time and end time.
16- Application usage duration based on the specified start time and end time.
17- Events of the caller application based on the specified start time and end time.
18- Application usage duration in the specified time frame at the specified interval (daily, weekly, monthly, or annually).
19- Priority group of the caller application.
20- Whether an application is in the idle state.
21- Feature Ability (FA) usage records sorted by time (most recent first).
22
23  **maxNum** specifies the maximum number of FA usage records returned. If **maxNum** is not specified, the default value **1000** will be used.
24- Number of notifications from applications based on the specified start time and end time.
25- System events (hibernation, wakeup, lock, and unlock) that occur between the specified start time and end time.
26- Priority group of the caller application or a given application.
27
28You can use **set()** to set the group for the application specified by **bundleName**.
29
30You can use **register()** to register a callback for application group changes. When an application group of the user changes, the change is notified to all applications that have registered the callback.
31
32You can use **unregister()** to deregister the callback for application group changes.
33
34## Required Permissions
35Only system applications can call the device usage statistics APIs. They must request the **ohos.permission.BUNDLE_ACTIVE_INFO** permission to call these APIs.