1e41f4b71Sopenharmony_ci# Device Usage Statistics Overview
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciDevice 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.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ciThe 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.
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci## Introduction
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciThe application usage statistics are flushed:
10e41f4b71Sopenharmony_ci- Every 30 minutes.
11e41f4b71Sopenharmony_ci- Upon system time changes.
12e41f4b71Sopenharmony_ci- Upon start of a new day.
13e41f4b71Sopenharmony_ci
14e41f4b71Sopenharmony_ciYou can use **query()** (including **isIdleState**) to obtain:
15e41f4b71Sopenharmony_ci- Events of all applications based on the specified start time and end time.
16e41f4b71Sopenharmony_ci- Application usage duration based on the specified start time and end time.
17e41f4b71Sopenharmony_ci- Events of the caller application based on the specified start time and end time.
18e41f4b71Sopenharmony_ci- Application usage duration in the specified time frame at the specified interval (daily, weekly, monthly, or annually).
19e41f4b71Sopenharmony_ci- Priority group of the caller application.
20e41f4b71Sopenharmony_ci- Whether an application is in the idle state.
21e41f4b71Sopenharmony_ci- Feature Ability (FA) usage records sorted by time (most recent first). 
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci  **maxNum** specifies the maximum number of FA usage records returned. If **maxNum** is not specified, the default value **1000** will be used.
24e41f4b71Sopenharmony_ci- Number of notifications from applications based on the specified start time and end time.
25e41f4b71Sopenharmony_ci- System events (hibernation, wakeup, lock, and unlock) that occur between the specified start time and end time.
26e41f4b71Sopenharmony_ci- Priority group of the caller application or a given application.
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ciYou can use **set()** to set the group for the application specified by **bundleName**.
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ciYou 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.
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ciYou can use **unregister()** to deregister the callback for application group changes.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci## Required Permissions
35e41f4b71Sopenharmony_ciOnly system applications can call the device usage statistics APIs. They must request the **ohos.permission.BUNDLE_ACTIVE_INFO** permission to call these APIs.