1# @ohos.resourceschedule.usageStatistics (Device Usage Statistics) (System API) 2 3The **usageStatistics** module provides APIs for collecting statistics on device usage. For example, you can use the APIs to query whether an application is commonly used and an application's priority group, usage duration, system events (hibernation, wakeup, unlocking, and screen locking), application events (foreground, background, and start and end of continuous tasks), and the number of notifications. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> 9> The APIs provided by this module are system APIs. 10 11## Modules to Import 12 13``` 14import { usageStatistics } from '@kit.BackgroundTasksKit' 15``` 16 17## usageStatistics.isIdleState 18 19isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void 20 21Checks whether an application is commonly used (with the value of **GroupType** being less than or equal to 30). This API uses an asynchronous callback to return the result. 22 23**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 24 25**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 26 27**Parameters** 28 29| Name | Type | Mandatory | Description | 30| ---------- | ---------------------------- | ---- | ---------------------------------------- | 31| bundleName | string | Yes | Bundle name of the application. | 32| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.<br>If the application is commonly used, **true** is returned. If the application is not commonly used or **bundleName** is invalid, **false** is returned.| 33 34**Error codes** 35 36For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 37 38| ID | Error Message | 39| ---- | --------------------- | 40| 201 | Permission denied. | 41| 202 | Not System App. | 42| 401 | Parameter error. | 43| 801 | Capability not supported.| 44| 10000001 | Memory operation failed. | 45| 10000002 | Parcel operation failed. | 46| 10000003 | System service operation failed. | 47| 10000004 | IPC failed. | 48| 10000006 | Failed to get the application information. | 49 50**Example** 51```ts 52import { BusinessError } from '@kit.BasicServicesKit'; 53 54usageStatistics.isIdleState("com.ohos.camera", (err: BusinessError, res: boolean) => { 55 if (err) { 56 console.log('BUNDLE_ACTIVE isIdleState callback failed. code is: ' + err.code + ',message is: ' + err.message); 57 } else { 58 console.log('BUNDLE_ACTIVE isIdleState callback succeeded, result: ' + JSON.stringify(res)); 59 } 60}); 61``` 62 63## usageStatistics.isIdleState 64 65isIdleState(bundleName: string): Promise<boolean> 66 67Checks whether an application is commonly used (with the value of **GroupType** being less than or equal to 30). This API uses a promise to return the result. 68 69**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 70 71**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 72 73**Parameters** 74 75| Name | Type | Mandatory | Description | 76| ---------- | ------ | ---- | -------------- | 77| bundleName | string | Yes | Bundle name of the application.| 78 79**Return value** 80 81| Type | Description | 82| ---------------------- | ---------------------------------------- | 83| Promise<boolean> | Promise used to return the result.<br>If the application is commonly used, **true** is returned. If the application is not commonly used or **bundleName** is invalid, **false** is returned.| 84 85**Error codes** 86 87For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 88 89| ID | Error Message | 90| ---- | --------------------- | 91| 201 | Permission denied. | 92| 202 | Not System App. | 93| 401 | Parameter error. | 94| 801 | Capability not supported.| 95| 10000001 | Memory operation failed. | 96| 10000002 | Parcel operation failed. | 97| 10000003 | System service operation failed. | 98| 10000004 | IPC failed. | 99| 10000006 | Failed to get the application information. | 100 101**Example** 102 103```ts 104import { BusinessError } from '@kit.BasicServicesKit'; 105 106usageStatistics.isIdleState("com.ohos.camera").then((res: boolean) => { 107 console.log('BUNDLE_ACTIVE isIdleState promise succeeded, result: ' + JSON.stringify(res)); 108}).catch((err: BusinessError) => { 109 console.log('BUNDLE_ACTIVE isIdleState promise failed. code is: ' + err.code + ',message is: ' + err.message); 110}); 111``` 112## usageStatistics.isIdleStateSync<sup>10+<sup> 113 114isIdleStateSync(bundleName: string): boolean 115 116Checks whether an application is commonly used (with the value of **GroupType** being less than or equal to 30). This API returns the result synchronously. 117 118**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 119 120**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 121 122**Parameters** 123 124| Name | Type | Mandatory | Description | 125| ---------- | ---------------------------- | ---- | ---------------------------------------- | 126| bundleName | string | Yes | Bundle name of the application. | 127 128**Return value** 129 130| Type | Description | 131| ---------------------- | ---------------------------------------- | 132| boolean | If the application is commonly used, **true** is returned. If the application is not commonly used or **bundleName** is invalid, **false** is returned.| 133 134**Error codes** 135 136For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 137 138| ID | Error Message | 139| ---- | --------------------- | 140| 201 | Permission denied. | 141| 202 | Not System App. | 142| 401 | Parameter error. | 143| 801 | Capability not supported.| 144| 10000001 | Memory operation failed. | 145| 10000002 | Parcel operation failed. | 146| 10000003 | System service operation failed. | 147| 10000004 | IPC failed. | 148| 10000006 | Failed to get the application information. | 149 150**Example** 151```ts 152let isIdleState: boolean = usageStatistics.isIdleStateSync("com.ohos.camera"); 153``` 154 155## usageStatistics.queryAppGroup 156 157queryAppGroup(): Promise<number> 158 159Queries the priority group of this application. This API uses a promise to return the result. 160 161**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 162 163**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 164 165**Return value** 166 167| Type | Description | 168| --------------- | --------------------------- | 169| Promise<number> | Promise used to return the priority group. A smaller value indicates a higher priority.| 170 171**Error codes** 172 173For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 174 175| ID | Error Message | 176| ---- | --------------------- | 177| 201 | Permission denied. | 178| 202 | Not System App. | 179| 401 | Parameter error. | 180| 801 | Capability not supported.| 181| 10000001 | Memory operation failed. | 182| 10000002 | Parcel operation failed. | 183| 10000003 | System service operation failed. | 184| 10000004 | IPC failed. | 185| 10000005 | Application is not installed. | 186| 10000006 | Failed to get the application information. | 187| 10100002 | Failed to get the application group information. | 188 189**Example** 190 191```ts 192import { BusinessError } from '@kit.BasicServicesKit'; 193 194usageStatistics.queryAppGroup().then((res: number) => { 195 console.log('BUNDLE_ACTIVE queryAppGroup promise succeeded. result: ' + JSON.stringify(res)); 196}).catch((err: BusinessError) => { 197 console.log('BUNDLE_ACTIVE queryAppGroup promise failed. code is: ' + err.code + ',message is: ' + err.message); 198}); 199``` 200 201## usageStatistics.queryAppGroup 202 203queryAppGroup(callback: AsyncCallback<number>): void 204 205Queries the priority group of this application. This API uses an asynchronous callback to return the result. 206 207**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 208 209**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 210 211**Parameters** 212 213| Name | Type | Mandatory | Description | 214| -------- | --------------------- | ---- | -------------------------- | 215| callback | AsyncCallback<number> | Yes | Callback used to return the priority group. A smaller value indicates a higher priority.| 216 217**Error codes** 218 219For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 220 221| ID | Error Message | 222| ---- | --------------------- | 223| 201 | Permission denied. | 224| 202 | Not System App. | 225| 401 | Parameter error. | 226| 801 | Capability not supported.| 227| 10000001 | Memory operation failed. | 228| 10000002 | Parcel operation failed. | 229| 10000003 | System service operation failed. | 230| 10000004 | IPC failed. | 231| 10000005 | Application is not installed. | 232| 10000006 | Failed to get the application information. | 233| 10100002 | Failed to get the application group information. | 234 235**Example** 236 237```ts 238import { BusinessError } from '@kit.BasicServicesKit'; 239 240usageStatistics.queryAppGroup((err: BusinessError, res: number) => { 241 if(err) { 242 console.log('BUNDLE_ACTIVE queryAppGroup callback failed. code is: ' + err.code + ',message is: ' + err.message); 243 } else { 244 console.log('BUNDLE_ACTIVE queryAppGroup callback succeeded. result: ' + JSON.stringify(res)); 245 } 246}); 247``` 248 249## usageStatistics.queryAppGroupSync<sup>10+<sup> 250 251queryAppGroupSync(): number 252 253Queries the priority group of this application. This API returns the result synchronously. 254 255**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 256 257**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 258 259**Return value** 260 261| Type | Description | 262| --------------- | --------------------------- | 263| number | Priority group. A smaller value indicates a higher priority.| 264 265**Error codes** 266 267For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 268 269| ID | Error Message | 270| ---- | --------------------- | 271| 201 | Permission denied. | 272| 202 | Not System App. | 273| 401 | Parameter error. | 274| 801 | Capability not supported.| 275| 10000001 | Memory operation failed. | 276| 10000002 | Parcel operation failed. | 277| 10000003 | System service operation failed. | 278| 10000004 | IPC failed. | 279| 10000005 | Application is not installed. | 280| 10000006 | Failed to get the application information. | 281| 10100002 | Failed to get the application group information. | 282 283**Example** 284 285```ts 286let priorityGroup: number = usageStatistics.queryAppGroupSync(); 287``` 288 289## usageStatistics.queryAppGroup 290 291queryAppGroup(bundleName : string): Promise<number> 292 293Queries the priority group of the application specified by **bundleName**. This API uses a promise to return the result. 294 295**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 296 297**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 298 299**Parameters** 300 301| Name | Type | Mandatory | Description | 302| ---------- | ------ | ---- | ---------------------------------------- | 303| bundleName | string | Yes | Bundle name of the application.| 304 305**Return value** 306 307| Type | Description | 308| --------------- | --------------------------- | 309| Promise<number> | Promise used to return the priority group. A smaller value indicates a higher priority.| 310 311**Error codes** 312 313For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 314 315| ID | Error Message | 316| ---- | --------------------- | 317| 201 | Permission denied. | 318| 202 | Not System App. | 319| 401 | Parameter error. | 320| 801 | Capability not supported.| 321| 10000001 | Memory operation failed. | 322| 10000002 | Parcel operation failed. | 323| 10000003 | System service operation failed. | 324| 10000004 | IPC failed. | 325| 10000005 | Application is not installed. | 326| 10000006 | Failed to get the application information. | 327| 10100002 | Failed to get the application group information. | 328 329**Example** 330 331```javascript 332// Promise mode when bundleName is specified 333import { BusinessError } from '@kit.BasicServicesKit'; 334 335let bundleName: string = "com.ohos.camera"; 336usageStatistics.queryAppGroup(bundleName).then((res: number) => { 337 console.log('BUNDLE_ACTIVE queryAppGroup promise succeeded. result: ' + JSON.stringify(res)); 338}).catch((err: BusinessError) => { 339 console.log('BUNDLE_ACTIVE queryAppGroup promise failed. code is: ' + err.code + ',message is: ' + err.message); 340}); 341``` 342 343## usageStatistics.queryAppGroup 344 345queryAppGroup(bundleName : string, callback: AsyncCallback<number>): void 346 347Queries the priority group of the application specified by **bundleName**. This API uses an asynchronous callback to return the result. 348 349**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 350 351**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 352 353**Parameters** 354 355| Name | Type | Mandatory | Description | 356| ---------- | --------------------- | ---- | ---------------------------------------- | 357| bundleName | string | Yes | Bundle name of the application.| 358| callback | AsyncCallback<number> | Yes | Callback used to return the priority group. A smaller value indicates a higher priority.| 359 360**Error codes** 361 362For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 363 364| ID | Error Message | 365| ---- | --------------------- | 366| 201 | Permission denied. | 367| 202 | Not System App. | 368| 401 | Parameter error. | 369| 801 | Capability not supported.| 370| 10000001 | Memory operation failed. | 371| 10000002 | Parcel operation failed. | 372| 10000003 | System service operation failed. | 373| 10000004 | IPC failed. | 374| 10000005 | Application is not installed. | 375| 10000006 | Failed to get the application information. | 376| 10100002 | Failed to get the application group information. | 377 378**Example** 379 380```ts 381import { BusinessError } from '@kit.BasicServicesKit'; 382 383let bundleName: string = "com.ohos.camera"; 384usageStatistics.queryAppGroup(bundleName, (err: BusinessError, res: number) => { 385 if(err) { 386 console.log('BUNDLE_ACTIVE queryAppGroup callback failed. code is: ' + err.code + ',message is: ' + err.message); 387 } else { 388 console.log('BUNDLE_ACTIVE queryAppGroup callback succeeded. result: ' + JSON.stringify(res)); 389 } 390}); 391``` 392 393## usageStatistics.queryAppGroupSync<sup>10+<sup> 394 395queryAppGroupSync(bundleName: string): number 396 397Queries the priority group of the application specified by **bundleName**. This API returns the result synchronously. 398 399**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 400 401**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 402 403**Parameters** 404 405| Name | Type | Mandatory | Description | 406| ---------- | ---------------------------- | ---- | ---------------------------------------- | 407| bundleName | string | Yes | Bundle name of the application. | 408 409**Return value** 410 411| Type | Description | 412| --------------- | --------------------------- | 413| number | Priority group. A smaller value indicates a higher priority.| 414 415**Error codes** 416 417For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 418 419| ID | Error Message | 420| ---- | --------------------- | 421| 201 | Permission denied. | 422| 202 | Not System App. | 423| 401 | Parameter error. | 424| 801 | Capability not supported.| 425| 10000001 | Memory operation failed. | 426| 10000002 | Parcel operation failed. | 427| 10000003 | System service operation failed. | 428| 10000004 | IPC failed. | 429| 10000005 | Application is not installed. | 430| 10000006 | Failed to get the application information. | 431| 10100002 | Failed to get the application group information. | 432 433**Example** 434 435```ts 436let priorityGroup: number = usageStatistics.queryAppGroupSync("com.ohos.camera"); 437``` 438 439## usageStatistics.setAppGroup 440 441setAppGroup(bundleName: string, newGroup: GroupType): Promise<void> 442 443Sets a new group for the application specified by **bundleName**. This API uses a promise to return the result. It can be called only by the current application. 444 445**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 446 447**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 448 449**Parameters** 450 451| Name | Type | Mandatory | Description | 452| ---------- | --------- | ---- | ---- | 453| bundleName | string | Yes | Bundle name of the application.| 454| newGroup | [GroupType](#grouptype) | Yes | Type of the new group. | 455 456**Return value** 457 458| Type | Description | 459| ------------- | ------------------------- | 460| Promise<void> | Promise that returns no value.| 461 462**Error codes** 463 464For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 465 466| ID | Error Message | 467| ---- | --------------------- | 468| 201 | Permission denied. | 469| 202 | Not System App. | 470| 401 | Parameter error. | 471| 801 | Capability not supported.| 472| 10000001 | Memory operation failed. | 473| 10000002 | Parcel operation failed. | 474| 10000003 | System service operation failed. | 475| 10000004 | IPC failed. | 476| 10000006 | Failed to get the application information. | 477| 10100001 | Repeated operation on the application group. | 478 479**Example** 480 481```ts 482import { BusinessError } from '@kit.BasicServicesKit'; 483 484let bundleName: string = "com.example.deviceUsageStatistics"; 485let newGroup = usageStatistics.GroupType.DAILY_GROUP; 486 487usageStatistics.setAppGroup(bundleName, newGroup).then( () => { 488 console.log('BUNDLE_ACTIVE setAppGroup promise succeeded.'); 489}).catch((err: BusinessError) => { 490 console.log('BUNDLE_ACTIVE setAppGroup promise failed. code is: ' + err.code + ',message is: ' + err.message); 491}); 492``` 493 494## usageStatistics.setAppGroup 495 496setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void 497 498Sets a new group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result. It can be called only by the current application. 499 500**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 501 502**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 503 504**Parameters** 505 506| Name | Type | Mandatory | Description | 507| ---------- | ------------------- | ---- | ------------------------- | 508| bundleName | string | Yes | Bundle name of the application. | 509| newGroup | [GroupType](#grouptype) | Yes | Type of the new group. | 510| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 511 512**Error codes** 513 514For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 515 516| ID | Error Message | 517| ---- | --------------------- | 518| 201 | Permission denied. | 519| 202 | Not System App. | 520| 401 | Parameter error. | 521| 801 | Capability not supported.| 522| 10000001 | Memory operation failed. | 523| 10000002 | Parcel operation failed. | 524| 10000003 | System service operation failed. | 525| 10000004 | IPC failed. | 526| 10000006 | Failed to get the application information. | 527| 10100001 | Repeated operation on the application group. | 528 529**Example** 530 531```ts 532import { BusinessError } from '@kit.BasicServicesKit'; 533 534let bundleName: string = "com.example.deviceUsageStatistics"; 535let newGroup = usageStatistics.GroupType.DAILY_GROUP; 536 537usageStatistics.setAppGroup(bundleName, newGroup, (err: BusinessError) => { 538 if(err) { 539 console.log('BUNDLE_ACTIVE setAppGroup callback failed. code is: ' + err.code + ',message is: ' + err.message); 540 } else { 541 console.log('BUNDLE_ACTIVE setAppGroup callback succeeded.'); 542 } 543}); 544``` 545 546## usageStatistics.queryBundleStatsInfos 547 548queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback<BundleStatsMap>): void 549 550Queries the application usage duration statistics based on the specified start time and end time, with the minimum granularity of a day. This API uses an asynchronous callback to return the result. 551 552**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 553 554**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 555 556**Parameters** 557 558| Name | Type | Mandatory | Description | 559| -------- | ---------------------------------------- | ---- | --------------------------------------- | 560| begin | number | Yes | Start time, in milliseconds. | 561| end | number | Yes | End time, in milliseconds. | 562| callback | AsyncCallback<[BundleStatsMap](#bundlestatsmap)> | Yes | Callback used to return the application usage duration statistics.| 563 564**Error codes** 565 566For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 567 568| ID | Error Message | 569| ---- | --------------------- | 570| 201 | Permission denied. | 571| 202 | Not System App. | 572| 401 | Parameter error. | 573| 801 | Capability not supported.| 574| 10000001 | Memory operation failed. | 575| 10000002 | Parcel operation failed. | 576| 10000003 | System service operation failed. | 577| 10000004 | IPC failed. | 578| 10000006 | Failed to get the application information. | 579| 10000007 | Failed to get the system time. | 580 581**Example** 582 583```ts 584import { BusinessError } from '@kit.BasicServicesKit'; 585 586usageStatistics.queryBundleStatsInfos(0, 20000000000000, (err: BusinessError, res:usageStatistics.BundleStatsMap) => { 587 if (err) { 588 console.log('BUNDLE_ACTIVE queryBundleStatsInfos callback failed. code is: ' + err.code + ',message is: ' + err.message); 589 } else { 590 console.log('BUNDLE_ACTIVE queryBundleStatsInfos callback success.'); 591 console.log('BUNDLE_ACTIVE queryBundleStatsInfos callback result ' + JSON.stringify(res)); 592 } 593}); 594``` 595 596## usageStatistics.queryBundleStatsInfos 597 598queryBundleStatsInfos(begin: number, end: number): Promise<BundleStatsMap> 599 600Queries the application usage duration statistics based on the specified start time and end time, with the minimum granularity of a day. This API uses a promise to return the result. 601 602**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 603 604**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 605 606**Parameters** 607 608| Name | Type | Mandatory | Description | 609| ----- | ------ | ---- | ----- | 610| begin | number | Yes | Start time, in milliseconds.| 611| end | number | Yes | End time, in milliseconds.| 612 613**Return value** 614 615| Type | Description | 616| ---------------------------------------- | -------------------------------------- | 617| Promise<[BundleStatsMap](#bundlestatsmap)> | Promise used to return the application usage duration statistics.| 618 619**Error codes** 620 621For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 622 623| ID | Error Message | 624| ---- | --------------------- | 625| 201 | Permission denied. | 626| 202 | Not System App. | 627| 401 | Parameter error. | 628| 801 | Capability not supported.| 629| 10000001 | Memory operation failed. | 630| 10000002 | Parcel operation failed. | 631| 10000003 | System service operation failed. | 632| 10000004 | IPC failed. | 633| 10000006 | Failed to get the application information. | 634| 10000007 | Failed to get the system time. | 635 636**Example** 637 638```ts 639import { BusinessError } from '@kit.BasicServicesKit'; 640 641usageStatistics.queryBundleStatsInfos(0, 20000000000000).then((res:usageStatistics.BundleStatsMap) => { 642 console.log('BUNDLE_ACTIVE queryBundleStatsInfos promise success.'); 643 console.log('BUNDLE_ACTIVE queryBundleStatsInfos promise result ' + JSON.stringify(res)); 644}).catch((err: BusinessError) => { 645 console.log('BUNDLE_ACTIVE queryBundleStatsInfos promise failed. code is: ' + err.code + ',message is: ' + err.message); 646}); 647``` 648 649## usageStatistics.queryBundleStatsInfoByInterval 650 651queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStatsInfo>>): void 652 653Queries the application usage duration statistics in the specified time frame at the specified interval (daily, weekly, monthly, or annually). This API uses an asynchronous callback to return the result. 654 655**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 656 657**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 658 659**Parameters** 660 661| Name | Type | Mandatory | Description | 662| ---------- | ---------------------------------------- | ---- | ---------------------------------------- | 663| byInterval | [IntervalType](#intervaltype) | Yes | Type of information to be queried. | 664| begin | number | Yes | Start time, in milliseconds. | 665| end | number | Yes | End time, in milliseconds. | 666| callback | AsyncCallback<Array<[BundleStatsInfo](#bundlestatsinfo)>> | Yes | Callback used to return the application usage duration statistics.| 667 668**Error codes** 669 670For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 671 672| ID | Error Message | 673| ---- | --------------------- | 674| 201 | Permission denied. | 675| 202 | Not System App. | 676| 401 | Parameter error. | 677| 801 | Capability not supported.| 678| 10000001 | Memory operation failed. | 679| 10000002 | Parcel operation failed. | 680| 10000003 | System service operation failed. | 681| 10000004 | IPC failed. | 682| 10000006 | Failed to get the application information. | 683| 10000007 | Failed to get the system time. | 684 685**Example** 686 687```ts 688import { BusinessError } from '@kit.BasicServicesKit'; 689 690usageStatistics.queryBundleStatsInfoByInterval(0, 0, 20000000000000, (err: BusinessError, res: Array<usageStatistics.BundleStatsInfo>) => { 691 if (err) { 692 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval callback failed. code is: ' + err.code + ',message is: ' + err.message); 693 } else { 694 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval callback success.'); 695 for (let i = 0; i < res.length; i++) { 696 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval callback number : ' + (i + 1)); 697 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval callback result ' + JSON.stringify(res[i])); 698 } 699 } 700}); 701``` 702 703## usageStatistics.queryBundleStatsInfoByInterval 704 705queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise<Array<BundleStatsInfo>> 706 707Queries the application usage duration statistics in the specified time frame at the specified interval (daily, weekly, monthly, or annually). This API uses a promise to return the result. 708 709**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 710 711**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 712 713**Parameters** 714 715| Name | Type | Mandatory | Description | 716| ---------- | ----------------------------- | ---- | ----- | 717| byInterval | [IntervalType](#intervaltype) | Yes | Type of information to be queried.| 718| begin | number | Yes | Start time, in milliseconds.| 719| end | number | Yes | End time, in milliseconds.| 720 721**Return value** 722 723| Type | Description | 724| ---------------------------------------- | ---------------------------------------- | 725| Promise<Array<[BundleStatsInfo](#bundlestatsinfo)>> | Promise used to return the application usage duration statistics.| 726 727**Error codes** 728 729For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 730 731| ID | Error Message | 732| ---- | --------------------- | 733| 201 | Permission denied. | 734| 202 | Not System App. | 735| 401 | Parameter error. | 736| 801 | Capability not supported.| 737| 10000001 | Memory operation failed. | 738| 10000002 | Parcel operation failed. | 739| 10000003 | System service operation failed. | 740| 10000004 | IPC failed. | 741| 10000006 | Failed to get the application information. | 742| 10000007 | Failed to get the system time. | 743 744**Example** 745 746```ts 747import { BusinessError } from '@kit.BasicServicesKit'; 748 749usageStatistics.queryBundleStatsInfoByInterval(0, 0, 20000000000000).then((res: Array<usageStatistics.BundleStatsInfo>) => { 750 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval promise success.'); 751 for (let i = 0; i < res.length; i++) { 752 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval promise number : ' + (i + 1)); 753 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval promise result ' + JSON.stringify(res[i])); 754 } 755}).catch((err: BusinessError) => { 756 console.log('BUNDLE_ACTIVE queryBundleStatsInfoByInterval promise failed. code is: ' + err.code + ',message is: ' + err.message); 757}); 758``` 759 760## usageStatistics.queryBundleEvents 761 762queryBundleEvents(begin: number, end: number, callback: AsyncCallback<Array<BundleEvents>>): void 763 764Queries events of all applications based on the specified start time and end time. This API uses an asynchronous callback to return the result. 765 766**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 767 768**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 769 770**Parameters** 771 772| Name | Type | Mandatory | Description | 773| -------- | ---------------------------------------- | ---- | --------------------------------------- | 774| begin | number | Yes | Start time, in milliseconds. | 775| end | number | Yes | End time, in milliseconds. | 776| callback | AsyncCallback<Array<[BundleEvents](#bundleevents)>> | Yes | Callback used to return the events.| 777 778**Error codes** 779 780For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 781 782| ID | Error Message | 783| ---- | --------------------- | 784| 201 | Permission denied. | 785| 202 | Not System App. | 786| 401 | Parameter error. | 787| 801 | Capability not supported.| 788| 10000001 | Memory operation failed. | 789| 10000002 | Parcel operation failed. | 790| 10000003 | System service operation failed. | 791| 10000004 | IPC failed. | 792| 10000006 | Failed to get the application information. | 793| 10000007 | Failed to get the system time. | 794 795**Example** 796 797```ts 798import { BusinessError } from '@kit.BasicServicesKit'; 799 800usageStatistics.queryBundleEvents(0, 20000000000000, (err: BusinessError, res: Array<usageStatistics.BundleEvents>) => { 801 if (err) { 802 console.log('BUNDLE_ACTIVE queryBundleEvents callback failed. code is: ' + err.code + ',message is: ' + err.message); 803 } else { 804 console.log('BUNDLE_ACTIVE queryBundleEvents callback success.'); 805 for (let i = 0; i < res.length; i++) { 806 console.log('BUNDLE_ACTIVE queryBundleEvents callback number : ' + (i + 1)); 807 console.log('BUNDLE_ACTIVE queryBundleEvents callback result ' + JSON.stringify(res[i])); 808 } 809 } 810}); 811``` 812 813## usageStatistics.queryBundleEvents 814 815queryBundleEvents(begin: number, end: number): Promise<Array<BundleEvents>> 816 817Queries events of all applications based on the specified start time and end time. This API uses a promise to return the result. 818 819**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 820 821**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 822 823**Parameters** 824 825| Name | Type | Mandatory | Description | 826| ----- | ------ | ---- | ----- | 827| begin | number | Yes | Start time, in milliseconds.| 828| end | number | Yes | End time, in milliseconds.| 829 830**Return value** 831 832| Type | Description | 833| ---------------------------------------- | -------------------------------------- | 834| Promise<Array<[BundleEvents](#bundleevents)>> | Promise used to return the events.| 835 836**Error codes** 837 838For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 839 840| ID | Error Message | 841| ---- | --------------------- | 842| 201 | Permission denied. | 843| 202 | Not System App. | 844| 401 | Parameter error. | 845| 801 | Capability not supported.| 846| 10000001 | Memory operation failed. | 847| 10000002 | Parcel operation failed. | 848| 10000003 | System service operation failed. | 849| 10000004 | IPC failed. | 850| 10000006 | Failed to get the application information. | 851| 10000007 | Failed to get the system time. | 852 853**Example** 854 855```ts 856import { BusinessError } from '@kit.BasicServicesKit'; 857 858usageStatistics.queryBundleEvents(0, 20000000000000).then((res: Array<usageStatistics.BundleEvents>) => { 859 console.log('BUNDLE_ACTIVE queryBundleEvents promise success.'); 860 for (let i = 0; i < res.length; i++) { 861 console.log('BUNDLE_ACTIVE queryBundleEvents promise number : ' + (i + 1)); 862 console.log('BUNDLE_ACTIVE queryBundleEvents promise result ' + JSON.stringify(res[i])); 863 } 864}).catch((err: BusinessError) => { 865 console.log('BUNDLE_ACTIVE queryBundleEvents promise failed. code is: ' + err.code + ',message is: ' + err.message); 866}); 867``` 868 869## usageStatistics.queryCurrentBundleEvents 870 871queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback<Array<BundleEvents>>): void 872 873Queries events of this application based on the specified start time and end time. This API uses an asynchronous callback to return the result. 874 875**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 876 877**Parameters** 878 879| Name | Type | Mandatory | Description | 880| -------- | ---------------------------------------- | ---- | --------------------------------------- | 881| begin | number | Yes | Start time, in milliseconds. | 882| end | number | Yes | End time, in milliseconds. | 883| callback | AsyncCallback<Array<[BundleEvents](#bundleevents)>> | Yes | Callback used to return the events.| 884 885**Error codes** 886 887For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 888 889| ID | Error Message | 890| ---- | --------------------- | 891| 202 | Not System App. | 892| 401 | Parameter error. | 893| 801 | Capability not supported.| 894| 10000001 | Memory operation failed. | 895| 10000002 | Parcel operation failed. | 896| 10000003 | System service operation failed. | 897| 10000004 | IPC failed. | 898| 10000006 | Failed to get the application information. | 899| 10000007 | Failed to get the system time. | 900 901**Example** 902 903```ts 904import { BusinessError } from '@kit.BasicServicesKit'; 905 906usageStatistics.queryCurrentBundleEvents(0, 20000000000000, (err: BusinessError, res: Array<usageStatistics.BundleEvents>) => { 907 if (err) { 908 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents callback failed. code is: ' + err.code + ',message is: ' + err.message); 909 } else { 910 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents callback success.'); 911 for (let i = 0; i < res.length; i++) { 912 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents callback number : ' + (i + 1)); 913 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents callback result ' + JSON.stringify(res[i])); 914 } 915 } 916}); 917``` 918 919## usageStatistics.queryCurrentBundleEvents 920 921queryCurrentBundleEvents(begin: number, end: number): Promise<Array<BundleEvents>> 922 923Queries events of this application based on the specified start time and end time. This API uses a promise to return the result. 924 925**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 926 927**Parameters** 928 929| Name | Type | Mandatory | Description | 930| ----- | ------ | ---- | ----- | 931| begin | number | Yes | Start time, in milliseconds.| 932| end | number | Yes | End time, in milliseconds.| 933 934**Return value** 935 936| Type | Description | 937| ---------------------------------------- | -------------------------------------- | 938| Promise<Array<[BundleEvents](#bundleevents)>> | Promise used to return the events.| 939 940**Error codes** 941 942For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 943 944| ID | Error Message | 945| ---- | --------------------- | 946| 202 | Not System App. | 947| 401 | Parameter error. | 948| 801 | Capability not supported.| 949| 10000001 | Memory operation failed. | 950| 10000002 | Parcel operation failed. | 951| 10000003 | System service operation failed. | 952| 10000004 | IPC failed. | 953| 10000006 | Failed to get the application information. | 954| 10000007 | Failed to get the system time. | 955 956**Example** 957 958```ts 959import { BusinessError } from '@kit.BasicServicesKit'; 960 961usageStatistics.queryCurrentBundleEvents(0, 20000000000000).then((res: Array<usageStatistics.BundleEvents>) => { 962 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents promise success.'); 963 for (let i = 0; i < res.length; i++) { 964 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents promise number : ' + (i + 1)); 965 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents promise result ' + JSON.stringify(res[i])); 966 } 967}).catch((err: BusinessError) => { 968 console.log('BUNDLE_ACTIVE queryCurrentBundleEvents promise failed. code is: ' + err.code + ',message is: ' + err.message); 969}); 970``` 971 972## usageStatistics.queryDeviceEventStats 973 974queryDeviceEventStats(begin: number, end: number): Promise<Array<DeviceEventStats>> 975 976Queries statistics about system events (hibernation, wakeup, unlocking, and locking) that occur between the specified start time and end time. This API uses a promise to return the result. 977 978**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 979 980**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 981 982**Parameters** 983 984| Name | Type | Mandatory | Description | 985| ----- | ------ | ---- | ----- | 986| begin | number | Yes | Start time, in milliseconds.| 987| end | number | Yes | End time, in milliseconds.| 988 989**Return value** 990 991| Type | Description | 992| ---------------------------------------- | ---------------------------------------- | 993| Promise<Array<[DeviceEventStats](#deviceeventstats)>> | Promise used to return the statistics about system events.| 994 995**Error codes** 996 997For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 998 999| ID | Error Message | 1000| ---- | --------------------- | 1001| 201 | Permission denied. | 1002| 202 | Not System App. | 1003| 401 | Parameter error. | 1004| 801 | Capability not supported.| 1005| 10000001 | Memory operation failed. | 1006| 10000002 | Parcel operation failed. | 1007| 10000003 | System service operation failed. | 1008| 10000004 | IPC failed. | 1009| 10000006 | Failed to get the application information. | 1010| 10000007 | Failed to get the system time. | 1011 1012**Example** 1013 1014```ts 1015import { BusinessError } from '@kit.BasicServicesKit'; 1016 1017usageStatistics.queryDeviceEventStats(0, 20000000000000).then((res: Array<usageStatistics.DeviceEventStats>) => { 1018 console.log('BUNDLE_ACTIVE queryDeviceEventStates promise success.'); 1019 console.log('BUNDLE_ACTIVE queryDeviceEventStates promise result ' + JSON.stringify(res)); 1020}).catch((err: BusinessError) => { 1021 console.log('BUNDLE_ACTIVE queryDeviceEventStats promise failed. code is: ' + err.code + ',message is: ' + err.message); 1022}); 1023``` 1024 1025## usageStatistics.queryDeviceEventStats 1026 1027queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback<Array<DeviceEventStats>>): void 1028 1029Queries statistics about system events (hibernation, wakeup, unlocking, and locking) that occur between the specified start time and end time. This API uses an asynchronous callback to return the result. 1030 1031**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1032 1033**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1034 1035**Parameters** 1036 1037| Name | Type | Mandatory | Description | 1038| -------- | ---------------------------------------- | ---- | ---------------------------------------- | 1039| begin | number | Yes | Start time, in milliseconds. | 1040| end | number | Yes | End time, in milliseconds. | 1041| callback | AsyncCallback<Array<[DeviceEventStats](#deviceeventstats)>> | Yes | Callback used to return the statistics about system events.| 1042 1043**Error codes** 1044 1045For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1046 1047| ID | Error Message | 1048| ---- | --------------------- | 1049| 201 | Permission denied. | 1050| 202 | Not System App. | 1051| 401 | Parameter error. | 1052| 801 | Capability not supported.| 1053| 10000001 | Memory operation failed. | 1054| 10000002 | Parcel operation failed. | 1055| 10000003 | System service operation failed. | 1056| 10000004 | IPC failed. | 1057| 10000006 | Failed to get the application information. | 1058| 10000007 | Failed to get the system time. | 1059 1060**Example** 1061 1062```ts 1063import { BusinessError } from '@kit.BasicServicesKit'; 1064 1065usageStatistics.queryDeviceEventStats(0, 20000000000000, (err: BusinessError, res: Array<usageStatistics.DeviceEventStats>) => { 1066 if(err) { 1067 console.log('BUNDLE_ACTIVE queryDeviceEventStats callback failed. code is: ' + err.code + ',message is: ' + err.message); 1068 } else { 1069 console.log('BUNDLE_ACTIVE queryDeviceEventStats callback success.'); 1070 console.log('BUNDLE_ACTIVE queryDeviceEventStats callback result ' + JSON.stringify(res)); 1071 } 1072}); 1073``` 1074 1075## usageStatistics.queryNotificationEventStats 1076 1077queryNotificationEventStats(begin: number, end: number): Promise<Array<DeviceEventStats>> 1078 1079Queries the number of notifications from all applications based on the specified start time and end time. This API uses a promise to return the result. 1080 1081**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1082 1083**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1084 1085**Parameters** 1086 1087| Name | Type | Mandatory | Description | 1088| ----- | ------ | ---- | ----- | 1089| begin | number | Yes | Start time, in milliseconds.| 1090| end | number | Yes | End time, in milliseconds.| 1091 1092**Return value** 1093 1094| Type | Description | 1095| ---------------------------------------- | ---------------------------------------- | 1096| Promise<Array<[DeviceEventStats](#deviceeventstats)>> | Promise used to return the number of notifications.| 1097 1098**Error codes** 1099 1100For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1101 1102| ID | Error Message | 1103| ---- | --------------------- | 1104| 201 | Permission denied. | 1105| 202 | Not System App. | 1106| 401 | Parameter error. | 1107| 801 | Capability not supported.| 1108| 10000001 | Memory operation failed. | 1109| 10000002 | Parcel operation failed. | 1110| 10000003 | System service operation failed. | 1111| 10000004 | IPC failed. | 1112| 10000006 | Failed to get the application information. | 1113| 10000007 | Failed to get the system time. | 1114 1115**Example** 1116 1117```ts 1118import { BusinessError } from '@kit.BasicServicesKit'; 1119 1120usageStatistics.queryNotificationEventStats(0, 20000000000000).then((res: Array<usageStatistics.DeviceEventStats>) => { 1121 console.log('BUNDLE_ACTIVE queryNotificationEventStats promise success.'); 1122 console.log('BUNDLE_ACTIVE queryNotificationEventStats promise result ' + JSON.stringify(res)); 1123}).catch((err: BusinessError) => { 1124 console.log('BUNDLE_ACTIVE queryNotificationEventStats promise failed. code is: ' + err.code + ',message is: ' + err.message); 1125}); 1126``` 1127 1128## usageStatistics.queryNotificationEventStats 1129 1130queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback<Array<DeviceEventStats>>): void 1131 1132Queries the number of notifications from all applications based on the specified start time and end time. This API uses an asynchronous callback to return the result. 1133 1134**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1135 1136**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1137 1138**Parameters** 1139 1140| Name | Type | Mandatory | Description | 1141| -------- | ---------------------------------------- | ---- | ---------------------------------------- | 1142| begin | number | Yes | Start time, in milliseconds. | 1143| end | number | Yes | End time, in milliseconds. | 1144| callback | AsyncCallback<Array<[DeviceEventStats](#deviceeventstats)>> | Yes | Callback used to return the number of notifications.| 1145 1146**Error codes** 1147 1148For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1149 1150| ID | Error Message | 1151| ---- | --------------------- | 1152| 201 | Permission denied. | 1153| 202 | Not System App. | 1154| 401 | Parameter error. | 1155| 801 | Capability not supported.| 1156| 10000001 | Memory operation failed. | 1157| 10000002 | Parcel operation failed. | 1158| 10000003 | System service operation failed. | 1159| 10000004 | IPC failed. | 1160| 10000006 | Failed to get the application information. | 1161| 10000007 | Failed to get the system time. | 1162 1163**Example** 1164 1165```ts 1166import { BusinessError } from '@kit.BasicServicesKit'; 1167 1168usageStatistics.queryNotificationEventStats(0, 20000000000000, (err: BusinessError, res: Array<usageStatistics.DeviceEventStats>) => { 1169 if(err) { 1170 console.log('BUNDLE_ACTIVE queryNotificationEventStats callback failed. code is: ' + err.code + ',message is: ' + err.message); 1171 } else { 1172 console.log('BUNDLE_ACTIVE queryNotificationEventStats callback success.'); 1173 console.log('BUNDLE_ACTIVE queryNotificationEventStats callback result ' + JSON.stringify(res)); 1174 } 1175}); 1176``` 1177 1178## usageStatistics.queryModuleUsageRecords 1179 1180queryModuleUsageRecords(): Promise<Array<HapModuleInfo>> 1181 1182Queries the usage records of unused HAP files for each application in the FA model. If the HAP file contains FA widgets, the usage records also contain the widget information. This API uses a promise to return the result. 1183 1184Queries FA usage records. This API uses a promise to return a maximum of 1000 FA usage records sorted by time (most recent first). 1185 1186**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1187 1188**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1189 1190**Return value** 1191 1192| Type | Description | 1193| ---------------------------------------- | ---------------------------------- | 1194| Promise<Array<[HapModuleInfo](#hapmoduleinfo)>> | Promise used to return the result. A maximum of 1000 usage records can be returned.| 1195 1196**Error codes** 1197 1198For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1199 1200| ID | Error Message | 1201| ---- | --------------------- | 1202| 201 | Permission denied. | 1203| 202 | Not System App. | 1204| 401 | Parameter error. | 1205| 801 | Capability not supported.| 1206| 10000001 | Memory operation failed. | 1207| 10000002 | Parcel operation failed. | 1208| 10000003 | System service operation failed. | 1209| 10000004 | IPC failed. | 1210| 10000006 | Failed to get the application information. | 1211| 10000007 | Failed to get the system time. | 1212 1213**Example** 1214 1215```ts 1216// Invocation when maxNum is not passed 1217import { BusinessError } from '@kit.BasicServicesKit'; 1218 1219usageStatistics.queryModuleUsageRecords().then((res: Array<usageStatistics.HapModuleInfo>) => { 1220 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise succeeded'); 1221 for (let i = 0; i < res.length; i++) { 1222 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise number : ' + (i + 1)); 1223 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise result ' + JSON.stringify(res[i])); 1224 } 1225}).catch((err: BusinessError) => { 1226 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise failed. code is: ' + err.code + ',message is: ' + err.message); 1227}); 1228``` 1229 1230## usageStatistics.queryModuleUsageRecords 1231 1232queryModuleUsageRecords(callback: AsyncCallback<Array<HapModuleInfo>>): void 1233 1234Queries the usage records of unused HAP files for each application in the FA model. If the HAP file contains FA widgets, the usage records also contain the widget information. This API uses an asynchronous callback to return the result. 1235 1236**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1237 1238**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1239 1240**Parameters** 1241 1242| Name | Type | Mandatory | Description | 1243| -------- | ---------------------------------------- | ---- | ----------------------------------- | 1244| callback | AsyncCallback<Array<[HapModuleInfo](#hapmoduleinfo)>> | Yes | Callback used to return the result. A maximum of 1000 usage records can be returned.| 1245 1246**Error codes** 1247 1248For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md). 1249 1250| ID | Error Message | 1251| ---------- | ---------------------------- | 1252| 10000001 | Memory operation failed. | 1253| 10000002 | Parcel operation failed. | 1254| 10000003 | System service operation failed. | 1255| 10000004 | IPC failed. | 1256| 10000006 | Failed to get the application information. | 1257| 10000007 | Failed to get the system time. | 1258 1259**Example** 1260 1261```ts 1262import { BusinessError } from '@kit.BasicServicesKit'; 1263 1264usageStatistics.queryModuleUsageRecords((err: BusinessError, res: Array<usageStatistics.HapModuleInfo>) => { 1265 if(err) { 1266 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback failed. code is: ' + err.code + ',message is: ' + err.message); 1267 } else { 1268 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback succeeded.'); 1269 for (let i = 0; i < res.length; i++) { 1270 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback number : ' + (i + 1)); 1271 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback result ' + JSON.stringify(res[i])); 1272 } 1273 } 1274}); 1275``` 1276 1277## usageStatistics.queryModuleUsageRecords 1278 1279queryModuleUsageRecords(maxNum: number): Promise<Array<HapModuleInfo>> 1280 1281Queries a given number of usage records of unused HAP files for each application in the FA model. If the HAP file contains FA widgets, the usage records also contain the widget information. This API uses a promise to return the result. 1282 1283**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1284 1285**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1286 1287**Parameters** 1288 1289| Name | Type | Mandatory | Description | 1290| ------ | ------ | ---- | ---------------------------------- | 1291| maxNum | number | Yes | Number of usage records, in the range [1, 1000].| 1292 1293**Return value** 1294 1295| Type | Description | 1296| ---------------------------------------- | ---------------------------------- | 1297| Promise<Array<[HapModuleInfo](#hapmoduleinfo)>> | Promise used to return the result. The usage records returned does not exceed the value of **maxNum**.| 1298 1299**Error codes** 1300 1301For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1302 1303| ID | Error Message | 1304| ---- | --------------------- | 1305| 201 | Permission denied. | 1306| 202 | Not System App. | 1307| 401 | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. | 1308| 801 | Capability not supported.| 1309| 10000001 | Memory operation failed. | 1310| 10000002 | Parcel operation failed. | 1311| 10000003 | System service operation failed. | 1312| 10000004 | IPC failed. | 1313| 10000006 | Failed to get the application information. | 1314| 10000007 | Failed to get the system time. | 1315 1316**Example** 1317 1318```ts 1319import { BusinessError } from '@kit.BasicServicesKit'; 1320 1321usageStatistics.queryModuleUsageRecords(1000).then((res: Array<usageStatistics.HapModuleInfo>) => { 1322 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise succeeded'); 1323 for (let i = 0; i < res.length; i++) { 1324 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise number : ' + (i + 1)); 1325 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise result ' + JSON.stringify(res[i])); 1326 } 1327}).catch((err: BusinessError) => { 1328 console.log('BUNDLE_ACTIVE queryModuleUsageRecords promise failed. code is: ' + err.code + ',message is: ' + err.message); 1329}); 1330``` 1331 1332## usageStatistics.queryModuleUsageRecords 1333 1334queryModuleUsageRecords(maxNum: number, callback: AsyncCallback<Array<HapModuleInfo>>): void 1335 1336Queries a given number of usage records of unused HAP files for each application in the FA model. If the HAP file contains FA widgets, the usage records also contain the widget information. This API uses an asynchronous callback to return the result. 1337 1338**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1339 1340**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1341 1342**Parameters** 1343 1344| Name | Type | Mandatory | Description | 1345| -------- | ---------------------------------------- | ---- | ----------------------------------- | 1346| maxNum | number | Yes | Number of usage records, in the range [1, 1000].| 1347| callback | AsyncCallback<Array<[HapModuleInfo](#hapmoduleinfo)>> | Yes | Callback used to return the result. The usage records returned does not exceed the value of **maxNum**.| 1348 1349**Error codes** 1350 1351For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1352 1353| ID | Error Message | 1354| ---- | --------------------- | 1355| 201 | Permission denied. | 1356| 202 | Not System App. | 1357| 401 | Parameter error. Possible cause: 1. Mandatory parameters are left unspecified; 2. Incorrect parameters types; 3. Parameter verification failed. | 1358| 801 | Capability not supported.| 1359| 10000001 | Memory operation failed. | 1360| 10000002 | Parcel operation failed. | 1361| 10000003 | System service operation failed. | 1362| 10000004 | IPC failed. | 1363| 10000006 | Failed to get the application information. | 1364| 10000007 | Failed to get the system time. | 1365 1366**Example** 1367 1368```ts 1369import { BusinessError } from '@kit.BasicServicesKit'; 1370 1371usageStatistics.queryModuleUsageRecords(1000, (err: BusinessError, res: Array<usageStatistics.HapModuleInfo>) => { 1372 if(err) { 1373 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback failed. code is: ' + err.code + ',message is: ' + err.message); 1374 } else { 1375 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback succeeded.'); 1376 for (let i = 0; i < res.length; i++) { 1377 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback number : ' + (i + 1)); 1378 console.log('BUNDLE_ACTIVE queryModuleUsageRecords callback result ' + JSON.stringify(res[i])); 1379 } 1380 } 1381}); 1382``` 1383 1384## usageStatistics.registerAppGroupCallBack 1385 1386registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>): Promise<void> 1387 1388Registers a callback for application group changes. When an application group of the user changes, an [AppGroupCallbackInfo](#appgroupcallbackinfo) instance is returned to all applications that have registered the callback. This API uses a promise to return the result. 1389 1390**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1391 1392**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1393 1394**Parameters** 1395 1396| Name | Type | Mandatory| Description | 1397| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | 1398| groupCallback | Callback<[AppGroupCallbackInfo](#appgroupcallbackinfo)> | Yes | Application group change information.| 1399 1400**Return value** 1401 1402| Type | Description | 1403| ------------- | ----------------------- | 1404| Promise<void> | Promise that returns no value.| 1405 1406**Error codes** 1407 1408For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1409 1410| ID | Error Message | 1411| ---- | --------------------- | 1412| 201 | Permission denied. | 1413| 202 | Not System App. | 1414| 401 | Parameter error. | 1415| 801 | Capability not supported.| 1416| 10000001 | Memory operation failed. | 1417| 10000002 | Parcel operation failed. | 1418| 10000003 | System service operation failed. | 1419| 10000004 | IPC failed. | 1420| 10100001 | Repeated operation on the application group. | 1421 1422 1423**Example** 1424 1425```ts 1426import { BusinessError } from '@kit.BasicServicesKit'; 1427 1428function onBundleGroupChanged(res: usageStatistics.AppGroupCallbackInfo) { 1429 console.log('BUNDLE_ACTIVE registerAppGroupCallBack RegisterGroupCallBack callback success.'); 1430 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appOldGroup is : ' + res.appOldGroup); 1431 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appNewGroup is : ' + res.appNewGroup); 1432 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result changeReason is : ' + res.changeReason); 1433 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result userId is : ' + res.userId); 1434 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result bundleName is : ' + res.bundleName); 1435}; 1436usageStatistics.registerAppGroupCallBack(onBundleGroupChanged).then( () => { 1437 console.log('BUNDLE_ACTIVE registerAppGroupCallBack promise succeeded.'); 1438}).catch((err: BusinessError) => { 1439 console.log('BUNDLE_ACTIVE registerAppGroupCallBack promise failed. code is: ' + err.code + ',message is: ' + err.message); 1440}); 1441``` 1442 1443## usageStatistics.registerAppGroupCallBack 1444 1445registerAppGroupCallBack(groupCallback: Callback<AppGroupCallbackInfo>, callback: AsyncCallback<void>): void 1446 1447Registers a callback for application group changes. When an application group of the user changes, an [AppGroupCallbackInfo](#appgroupcallbackinfo) instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result. 1448 1449**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1450 1451**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1452 1453**Parameters** 1454 1455| Name | Type | Mandatory| Description | 1456| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------- | 1457| groupCallback | Callback<[AppGroupCallbackInfo](#appgroupcallbackinfo)> | Yes | Application group change information. | 1458| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 1459 1460**Error codes** 1461 1462For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Universal Error Codes](../errorcode-universal.md). 1463 1464| ID | Error Message | 1465| ---- | --------------------- | 1466| 201 | Permission denied. | 1467| 202 | Not System App. | 1468| 401 | Parameter error. | 1469| 801 | Capability not supported.| 1470| 10000001 | Memory operation failed. | 1471| 10000002 | Parcel operation failed. | 1472| 10000003 | System service operation failed. | 1473| 10000004 | IPC failed. | 1474| 10100001 | Repeated operation on the application group. | 1475 1476 1477**Example** 1478 1479```ts 1480import { BusinessError } from '@kit.BasicServicesKit'; 1481 1482function onBundleGroupChanged(res: usageStatistics.AppGroupCallbackInfo) { 1483 console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); 1484 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appOldGroup is : ' + res.appOldGroup); 1485 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result appNewGroup is : ' + res.appNewGroup); 1486 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result changeReason is : ' + res.changeReason); 1487 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result userId is : ' + res.userId); 1488 console.log('BUNDLE_ACTIVE registerAppGroupCallBack result bundleName is : ' + res.bundleName); 1489}; 1490usageStatistics.registerAppGroupCallBack(onBundleGroupChanged, (err: BusinessError) => { 1491 if(err) { 1492 console.log('BUNDLE_ACTIVE registerAppGroupCallBack callback failed. code is: ' + err.code + ',message is: ' + err.message); 1493 } else { 1494 console.log('BUNDLE_ACTIVE registerAppGroupCallBack callback success.'); 1495 } 1496}); 1497``` 1498 1499## usageStatistics.unregisterAppGroupCallBack 1500 1501unregisterAppGroupCallBack(): Promise<void> 1502 1503Unregisters the callback for application group changes. This API uses a promise to return the result. 1504 1505**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1506 1507**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1508 1509**Return value** 1510 1511| Type | Description | 1512| ------------- | ------------------------ | 1513| Promise<void> | Promise that returns no value.| 1514 1515**Error codes** 1516 1517For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1518 1519| ID | Error Message | 1520| ---- | --------------------- | 1521| 201 | Permission denied. | 1522| 202 | Not System App. | 1523| 401 | Parameter error. | 1524| 801 | Capability not supported.| 1525| 10000001 | Memory operation failed. | 1526| 10000002 | Parcel operation failed. | 1527| 10000003 | System service operation failed. | 1528| 10000004 | IPC failed. | 1529| 10100001 | Repeated operation on the application group. | 1530 1531**Example** 1532 1533```ts 1534import { BusinessError } from '@kit.BasicServicesKit'; 1535 1536usageStatistics.unregisterAppGroupCallBack().then( () => { 1537 console.log('BUNDLE_ACTIVE unregisterAppGroupCallBack promise succeeded.'); 1538}).catch((err: BusinessError) => { 1539 console.log('BUNDLE_ACTIVE unregisterAppGroupCallBack promise failed. code is: ' + err.code + ',message is: ' + err.message); 1540}); 1541``` 1542 1543## usageStatistics.unregisterAppGroupCallBack 1544 1545unregisterAppGroupCallBack(callback: AsyncCallback<void>): void; 1546 1547Unregisters the callback for application group changes. This API uses an asynchronous callback to return the result. 1548 1549**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO 1550 1551**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1552 1553**Parameters** 1554 1555| Name | Type | Mandatory | Description | 1556| -------- | ------------------- | ---- | -------------- | 1557| callback | AsyncCallback<void> | Yes | Callback used to return the result.| 1558 1559**Error codes** 1560 1561For details about the error codes, see [DeviceUsageStatistics Error Codes](errorcode-DeviceUsageStatistics.md) and [Common Error Codes](../errorcode-universal.md). 1562 1563| ID | Error Message | 1564| ---- | --------------------- | 1565| 201 | Permission denied. | 1566| 202 | Not System App. | 1567| 401 | Parameter error. | 1568| 801 | Capability not supported.| 1569| 10000001 | Memory operation failed. | 1570| 10000002 | Parcel operation failed. | 1571| 10000003 | System service operation failed. | 1572| 10000004 | IPC failed. | 1573| 10100001 | Repeated operation on the application group. | 1574 1575**Example** 1576 1577```ts 1578import { BusinessError } from '@kit.BasicServicesKit'; 1579 1580usageStatistics.unregisterAppGroupCallBack((err: BusinessError) => { 1581 if(err) { 1582 console.log('BUNDLE_ACTIVE unregisterAppGroupCallBack callback failed. code is: ' + err.code + ',message is: ' + err.message); 1583 } else { 1584 console.log('BUNDLE_ACTIVE unregisterAppGroupCallBack callback success.'); 1585 } 1586}); 1587``` 1588 1589## HapModuleInfo 1590 1591Defines the information about the usage record in the FA model. 1592 1593**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1594 1595| Name | Type | Mandatory | Description | 1596| -------------------- | ---------------------------------------- | ---- | ----------------------------- | 1597| deviceId | string | No | Device ID. | 1598| bundleName | string | Yes | Bundle name. | 1599| moduleName | string | Yes | Name of the module to which the FA belongs. | 1600| abilityName | string | No | **MainAbility** name of the FA. | 1601| appLabelId | number | No | Application label ID of the FA. | 1602| labelId | number | No | Label ID of the module to which the FA belongs. | 1603| descriptionId | number | No | Description ID of the application to which the FA belongs. | 1604| abilityLableId | number | No | **MainAbility** label ID of the FA. | 1605| abilityDescriptionId | number | No | **MainAbility** description ID of the FA.| 1606| abilityIconId | number | No | **MainAbility** icon ID of the FA. | 1607| launchedCount | number | Yes | Number of FA startup times. | 1608| lastModuleUsedTime | number | Yes | Last time when the FA was used. | 1609| formRecords | Array<[HapFormInfo](#hapforminfo)> | Yes | Array of widget usage records in the FA. | 1610 1611## HapFormInfo 1612 1613Defines the information about the usage record of FA widgets. 1614 1615**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1616 1617| Name | Type | Mandatory | Description | 1618| ---------------- | ------ | ---- | ----------- | 1619| formName | string | Yes | Widget name. | 1620| formDimension | number | Yes | Widget dimensions. | 1621| formId | number | Yes | Widget ID. | 1622| formLastUsedTime | number | Yes | Last time when the widget was clicked.| 1623| count | number | Yes | Number of clicks on the widget. | 1624 1625## AppGroupCallbackInfo 1626 1627Provides the application group changes returned through a callback. 1628 1629**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1630 1631| Name | Type | Mandatory| Description | 1632| ---------------- | ------ | ---- | ---------------- | 1633| appOldGroup | number | Yes | Application group before the change.| 1634| appNewGroup | number | Yes | Application group after the change.| 1635| userId | number | Yes | User ID. | 1636| changeReason | number | Yes | Reason for the group change.<br>- 256 (default): A record is initially created.<br>- 512: An exception occurs when the priority group is calculated.<br>- 768: The usage duration changes.<br>- 1024: Another application forcibly sets a priority group for the current application.| 1637| bundleName | string | Yes | Bundle name. | 1638 1639## BundleStatsInfo 1640 1641Provides the usage duration information of an application. 1642 1643**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1644 1645| Name | Type | Mandatory | Description | 1646| ------------------------ | ------ | ---- | ---------------------------------------- | 1647| bundleName | string | No | Bundle name of the application. | 1648| abilityPrevAccessTime | number | No | Last time when the application was used. | 1649| abilityInFgTotalTime | number | No | Total time that the application runs in the foreground. | 1650| id | number | Yes | User ID.| 1651| abilityPrevSeenTime | number | No | Last time when the application was visible in the foreground.| 1652| abilitySeenTotalTime | number | No | Total time that the application is visible in the foreground.| 1653| fgAbilityAccessTotalTime | number | No | Total time that the application accesses the foreground.| 1654| fgAbilityPrevAccessTime | number | No | Last time when the application accessed the foreground.| 1655| infosBeginTime | number | No | Time logged in the first application usage record in the **BundleActiveInfo** object.| 1656| infosEndTime | number | No | Time logged in the last application usage record in the **BundleActiveInfo** object.| 1657 1658## BundleEvents 1659 1660Provides information about an application event. 1661 1662**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1663 1664| Name | Type | Mandatory | Description | 1665| --------------------- | ------ | ---- | ---------------------------------------- | 1666| bundleName | string | No | Bundle name of the application. | 1667| eventId | number | No | Application event type. | 1668| eventOccurredTime | number | No | Timestamp when the application event occurs. | 1669| appGroup | number | No | Group of the application by usage priority.| 1670| indexOfLink | string | No | Shortcut ID.| 1671| nameOfClass | string | No | Class name.| 1672 1673## BundleStatsMap 1674 1675Provides the usage duration information of an application. 1676 1677**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1678 1679|Name | Description | 1680| ------------------------------ | ---------------------------------------- | 1681| Record<string, [BundleStatsInfo](#bundlestatsinfo)> | Usage duration information by application.| 1682 1683## DeviceEventStats 1684 1685Provides statistics about notifications and system events. 1686 1687**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1688 1689| Name | Type | Mandatory | Description | 1690| ------- | ------ | ---- | ----------------- | 1691| name | string | Yes | Bundle name of the notification sending application or system event name. | 1692| eventId | number | Yes | Type of the notification or system event. | 1693| count | number | Yes | Number of application notifications or system event triggering times.| 1694 1695## IntervalType 1696 1697Enumerates the interval types for querying the application usage duration. 1698 1699**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App 1700 1701| Name | Value | Description | 1702| ------------ | ---- | ---------------------------------------- | 1703| BY_OPTIMIZED | 0 | The system queries the application usage duration statistics in the specified time frame at the interval the system deems appropriate.| 1704| BY_DAILY | 1 | The system queries the application usage duration statistics in the specified time frame on a daily basis. | 1705| BY_WEEKLY | 2 | The system queries the application usage duration statistics in the specified time frame on a weekly basis. | 1706| BY_MONTHLY | 3 | The system queries the application usage duration statistics in the specified time frame on a monthly basis. | 1707| BY_ANNUALLY | 4 | The system queries the application usage duration statistics in the specified time frame on an annual basis. | 1708 1709## GroupType 1710 1711Enumerates the application group types. 1712 1713**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup 1714 1715| Name | Value | Description | 1716| ------------------ | ---- | ----------------- | 1717| ALIVE_GROUP | 10 | Group of active applications. | 1718| DAILY_GROUP | 20 | Group of frequently used applications that are not in the active state. | 1719| FIXED_GROUP | 30 | Group of applications that are used periodically but not every day.| 1720| RARE_GROUP | 40 | Group of rarely used applications. | 1721| LIMITED_GROUP | 50 | Group of restricted applications. | 1722| NEVER_GROUP | 60 | Group of applications that have been installed but never run. | 1723