From e257071f6a2a450b6f9f69c3aa3eb125c21ae939 Mon Sep 17 00:00:00 2001 From: houdisheng Date: Tue, 12 Apr 2022 10:40:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=AF=84=E5=AE=A1=E6=84=8F?= =?UTF-8?q?=E8=A7=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: houdisheng --- .../device-usage-statistics-dev-guide.md | 22 +++++++-------- .../apis/js-apis-deviceUsageStatistics.md | 28 +++++++++---------- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md index 792b939a96..bbeb28556c 100644 --- a/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md +++ b/zh-cn/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md @@ -21,7 +21,7 @@ import stats from '@ohos.bundleState'; | function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback<Array<BundleStateInfo>>): void | 通过指定时间段间隔(天、周、月、年)查询应用使用时长统计信息。 | | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | 查询(返回)当前调用者应用的使用优先级群组。 | | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 判断指定Bundle Name的应用当前是否是空闲状态。 | -| function getModuleUsageRecord(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 | +| function getRecentUsageModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 | ## 开发步骤 @@ -213,25 +213,25 @@ import stats from '@ohos.bundleState'; import stats from '@ohos.bundleState' // 异步方法promise方式 - stats.getModuleUsageRecord(this.maxNum).then( res => { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise succeeded'); + stats.getRecentUsageModules(this.maxNum).then( res => { + console.log('BUNDLE_ACTIVE getRecentUsageModules promise succeeded'); for (let i = 0; i < res.length; i++) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise number : ' + (i + 1)); - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise result ' + JSON.stringify(res[i])); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise result ' + JSON.stringify(res[i])); } }).catch( err=> { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise failed, because: ' + err.code); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise failed, because: ' + err.code); }); // 异步方法callback方式 - stats.getModuleUsageRecord(this.maxNum,(err, res) => { + stats.getRecentUsageModules(this.maxNum,(err, res) => { if(err) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback failed, because: ' + err.code); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback failed, because: ' + err.code); } else { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback succeeded.'); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback succeeded.'); for (let i = 0; i < res.length; i++) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback number : ' + (i + 1)); - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback result ' + JSON.stringify(res[i])); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback result ' + JSON.stringify(res[i])); } } }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md index 07311dd91c..b89d5012d8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -403,9 +403,9 @@ queryCurrentBundleActiveStates(begin: number, end: number): Promise<Array< }); ``` -## bundleState.getModuleUsageRecord9+ +## bundleState.getRecentUsageModules9+ -getModuleUsageRecord(maxNum: number): Promise<Array<BundleActiveModuleInfo>> +getRecentUsageModules(maxNum: number): Promise<Array<BundleActiveModuleInfo>> 据maxNum,查询FA使用记录,使用Promise形式返回不超过maxNum条FA使用记录,maxNum最大为1000。 @@ -428,20 +428,20 @@ getModuleUsageRecord(maxNum: number): Promise<Array<BundleActiveModuleInfo **示例**: ```js - bundleState.getModuleUsageRecord(this.maxNum).then( res => { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise succeeded'); + bundleState.getRecentUsageModules(this.maxNum).then( res => { + console.log('BUNDLE_ACTIVE getRecentUsageModules promise succeeded'); for (let i = 0; i < res.length; i++) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise number : ' + (i + 1)); - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise result ' + JSON.stringify(res[i])); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise result ' + JSON.stringify(res[i])); } }).catch( err=> { - console.log('BUNDLE_ACTIVE getModuleUsageRecord promise failed, because: ' + err.code); + console.log('BUNDLE_ACTIVE getRecentUsageModules promise failed, because: ' + err.code); }); ``` -## bundleState.getModuleUsageRecord9+ +## bundleState.getRecentUsageModules9+ -getModuleUsageRecord(maxNum: number): Promise<Array<BundleActiveModuleInfo>> +getRecentUsageModules(maxNum: number): Promise<Array<BundleActiveModuleInfo>> 查询FA使用记录。使用callback形式返回数量最大不超过maxNum设置的值,maxNum最大为1000。 @@ -459,14 +459,14 @@ getModuleUsageRecord(maxNum: number): Promise<Array<BundleActiveModuleInfo **示例**: ```js - bundleState.getModuleUsageRecord(this.maxNum,(err, res) => { + bundleState.getRecentUsageModules(this.maxNum,(err, res) => { if(err) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback failed, because: ' + err.code); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback failed, because: ' + err.code); } else { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback succeeded.'); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback succeeded.'); for (let i = 0; i < res.length; i++) { - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback number : ' + (i + 1)); - console.log('BUNDLE_ACTIVE getModuleUsageRecord callback result ' + JSON.stringify(res[i])); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback number : ' + (i + 1)); + console.log('BUNDLE_ACTIVE getRecentUsageModules callback result ' + JSON.stringify(res[i])); } } }); -- GitLab