diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 4478eceb76e79a4ff0873eee07a6cd0fc2a6cf17..fa0eac3fef8845b3e16cbac42a7894523fd69e1f 100644 --- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -11,17 +11,19 @@ import bundleState from '@ohos.bundleState' ``` ## bundleState.isIdleState -isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void
+ +isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void + Checks whether the application specified by **bundleName** is in the idle state. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| bundleName | string | Yes| Bundle name of an application.| -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | bundleName | string | Yes| Bundle name of an application.| + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| **Example** @@ -36,22 +38,24 @@ Checks whether the application specified by **bundleName** is in the idle state. ``` ## bundleState.isIdleState -isIdleState(bundleName: string): Promise<boolean>
+ +isIdleState(bundleName: string): Promise<boolean> + Checks whether the application specified by **bundleName** is in the idle state. This API uses a promise to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| bundleName | string | Yes| Bundle name of an application.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | bundleName | string | Yes| Bundle name of an application.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result. Returns whether the application specified by **bundleName** is in the idle state if the value of **bundleName** is valid; returns **null** otherwise.| **Example** @@ -64,16 +68,18 @@ Checks whether the application specified by **bundleName** is in the idle state. ``` ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void
+ +queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void + Queries the priority group of the current invoker application. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<number> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<number> | Yes| Callback used to return the result.| **Example** @@ -88,16 +94,18 @@ Queries the priority group of the current invoker application. This API uses an ``` ## bundleState.queryAppUsagePriorityGroup -queryAppUsagePriorityGroup(): Promise<number>
+ +queryAppUsagePriorityGroup(): Promise<number> + Queries the priority group of the current invoker application. This API uses a promise to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup **Return value** -| Type| Description| -| -------- | -------- | -| Promise<number> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<number> | Promise used to return the result.| **Example** @@ -110,19 +118,22 @@ Queries the priority group of the current invoker application. This API uses a p ``` ## bundleState.queryBundleStateInfos -queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback<BundleActiveInfoResponse>): void
-Queries the application usage duration statistics based on the specified start time and end time. This API uses an asynchronous callback to return the result.
+ +queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback<BundleActiveInfoResponse>): void + +Queries the application usage duration statistics based on the specified start time and end time. This API uses an asynchronous callback to return the result. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| -| callback | AsyncCallback<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| + | callback | AsyncCallback<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Yes| Callback used to return the result.| **Example** @@ -143,24 +154,27 @@ Queries the application usage duration statistics based on the specified start t ``` ## bundleState.queryBundleStateInfos -queryBundleStateInfos(begin: number, end: number): Promise<BundleActiveInfoResponse>
-Queries the application usage duration statistics based on the specified start time and end time. This API uses a promise to return the result.
+ +queryBundleStateInfos(begin: number, end: number): Promise<BundleActiveInfoResponse> + +Queries the application usage duration statistics based on the specified start time and end time. This API uses a promise to return the result. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<[BundleActiveInfoResponse](#bundleactiveinforesponse)> | Promise used to return the result.| **Example** @@ -179,20 +193,23 @@ Queries the application usage duration statistics based on the specified start t ``` ## bundleState.queryBundleStateInfoByInterval -queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void
-Queries 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.
+ +queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void + +Queries 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. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| -| callback | AsyncCallback<Array<[BundleStateInfo](#bundlestateinfo)>> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| + | callback | AsyncCallback<Array<[BundleStateInfo](#bundlestateinfo)>> | Yes| Callback used to return the result.| **Example** @@ -211,25 +228,28 @@ Queries the application usage duration statistics in the specified time frame at ``` ## bundleState.queryBundleStateInfoByInterval -queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise<Array<BundleStateInfo>>
-Queries 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.
+ +queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise<Array<BundleStateInfo>> + +Queries 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. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | byInterval | [IntervalType](#intervaltype) | Yes| Interval type.| + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<Array<[BundleStateInfo](#bundlestateinfo)>> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<Array<[BundleStateInfo](#bundlestateinfo)>> | Promise used to return the result.| **Example** @@ -246,19 +266,22 @@ Queries the application usage duration statistics in the specified time frame at ``` ## bundleState.queryBundleActiveStates -queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void
-Queries events of all applications based on the specified start time and end time. This API uses an asynchronous callback to return the result.
+ +queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void + +Queries events of all applications based on the specified start time and end time. This API uses an asynchronous callback to return the result. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| -| callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| + | callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| **Example** @@ -277,24 +300,27 @@ Queries events of all applications based on the specified start time and end tim ``` ## bundleState.queryBundleActiveStates -queryBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>
-Queries events of all applications based on the specified start time and end time. This API uses a promise to return the result.
+ +queryBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>> + +Queries events of all applications based on the specified start time and end time. This API uses a promise to return the result. + **Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| **Example** @@ -311,18 +337,20 @@ Queries events of all applications based on the specified start time and end tim ``` ## bundleState.queryCurrentBundleActiveStates -queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void
+ +queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveState>>): void + Queries events of this application based on the specified start time and end time. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| -| callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| + | callback | AsyncCallback<Array<[BundleActiveState](#bundleactivestate)>> | Yes| Callback used to return the result.| **Example** @@ -341,23 +369,25 @@ Queries events of this application based on the specified start time and end tim ``` ## bundleState.queryCurrentBundleActiveStates -queryCurrentBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>>
+ +queryCurrentBundleActiveStates(begin: number, end: number): Promise<Array<BundleActiveState>> + Queries events of this application based on the specified start time and end time. This API uses a promise to return the result. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| begin | number | Yes| Start time.| -| end | number | Yes| End time.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | begin | number | Yes| Start time.| + | end | number | Yes| End time.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<Array<[BundleActiveState](#bundleactivestate)>> | Promise used to return the result.| **Example** @@ -377,6 +407,7 @@ Queries events of this application based on the specified start time and end tim Provides the usage duration information of an application. ### Attributes + **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App | Name| Type| Mandatory| Description| @@ -390,23 +421,26 @@ Provides the usage duration information of an application. | fgAbilityAccessTotalTime | number | No| Total time that the application accesses the foreground.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| | fgAbilityPrevAccessTime | number | No| Last time when the application accessed the foreground.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| | infosBeginTime | number | No| Time logged in the first application usage record in the **BundleActiveInfo** object.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| -| infosBeginTime | number | No| Time logged in the last application usage record in the **BundleActiveInfo** object.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| +| infosEndTime | number | No| Time logged in the last application usage record in the **BundleActiveInfo** object.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| ### merge + merge(toMerge: BundleStateInfo): void -Merges the application usage information that has the same bundle name.
+Merges the application usage information that has the same bundle name. + This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| toMerge | [BundleStateInfo](#bundlestateinfo) | Yes| Application usage information to merge.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | toMerge | [BundleStateInfo](#bundlestateinfo) | Yes| Application usage information to merge.| ## BundleActiveState + Provides information about an application event. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App @@ -421,15 +455,17 @@ Provides information about an application event. | nameOfClass | string | No| Class name.
This API is defined but not implemented in OpenHarmony 3.1 Release. It will be available for use in OpenHarmony 3.1 MR.| ## BundleActiveInfoResponse + Provides the usage duration information of applications. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| [key: string]: BundleStateInfo | [BundleStateInfo](#bundlestateinfo) | Yes| Usage duration information by application.| +| [key: string]: BundleStateInfo | [key: string]: [BundleStateInfo](#bundlestateinfo) | Yes| Usage duration information by application.| ## IntervalType + Enumerates the interval types for querying the application usage duration. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App