From 33ec131e0315cbce43eb52b306fb59f8654d415c Mon Sep 17 00:00:00 2001 From: houdisheng Date: Thu, 23 Jun 2022 14:44:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9getRecentlyUsedModules?= =?UTF-8?q?=E5=8F=AF=E9=80=89=E5=8F=82=E6=95=B0=E6=8E=A5=E5=8F=A3=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E5=A4=8DformName=E7=B1=BB=E5=9E=8B=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E9=97=AE=E9=A2=98=EF=BC=8C=E5=90=8C=E6=AD=A5monthly=E5=88=86?= =?UTF-8?q?=E6=94=AF?= 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 | 28 +++++++++---------- .../apis/js-apis-deviceUsageStatistics.md | 2 +- 2 files changed, 15 insertions(+), 15 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 a7c47e93fd..c24e83427a 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 @@ -22,7 +22,7 @@ import stats from '@ohos.bundleState'; | function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | 查询当前应用的使用优先级群组。callback形式。 | | function queryAppUsagePriorityGroup(): Promise<number>; | 查询当前应用的使用优先级群组。promise形式。 | | function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | 判断指定Bundle Name的应用当前是否是空闲状态。 | -| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录。 | +| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | 根据maxNum,查询FA使用记录,返回不超过maxNum条FA使用记录,若不填写maxNum参数,则默认maxNum值为1000。 | | function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | 通过指定起始和结束时间查询所有应用的通知次数。 | | function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | 通过指定起始和结束时间查询系统事件(休眠、唤醒、解锁、锁屏)统计信息。 | | function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | 查询当前调用者应用或者指定应用的使用优先级群组。callback形式。 | @@ -178,14 +178,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // promise方式 stats.queryAppUsagePriorityGroup().then( res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // callback方式 stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -195,7 +195,7 @@ import stats from '@ohos.bundleState'; } }); ``` - + 7. 判断指定Bundle Name的应用当前是否是空闲状态,config.json中不需要配置权限,三方应用只能查询自身的空闲状态。 ```js @@ -300,7 +300,7 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // 异步方法promise方式 stats.queryBundleActiveEventStates(0, 20000000000000).then( res => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise success.'); @@ -308,7 +308,7 @@ import stats from '@ohos.bundleState'; }).catch( err => { console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise failed, because: ' + err.code); }); - + // 异步方法callback方式 stats.queryBundleActiveEventStates(0, 20000000000000, (err, res) => { if (err) { @@ -324,14 +324,14 @@ import stats from '@ohos.bundleState'; ```js import stats from '@ohos.bundleState' - + // 无参异步方法promise方式 stats.queryAppUsagePriorityGroup().then( res => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code); }); - + // 无参异步方法callback方式 stats.queryAppUsagePriorityGroup((err, res) => { if (err) { @@ -340,14 +340,14 @@ import stats from '@ohos.bundleState'; console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res)); } }); - + //有参异步promise方式 stats.queryAppUsagePriorityGroup(this.bundleName).then( res => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res)); }).catch( err => { console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code); }); - + //有参异步方法callback方式 stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => { if(err) { @@ -362,7 +362,7 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + //异步方法promise stats.setBundleGroup(this.bundleName, this.newGroup).then( () => { console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.'); @@ -383,7 +383,7 @@ import stats from '@ohos.bundleState'; ```javascript import stats from '@ohos.bundleState' - + //异步方法promise形式 let onBundleGroupChanged = (err,res) =>{ console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.'); @@ -415,12 +415,12 @@ import stats from '@ohos.bundleState'; } }); ``` - + 13. 解除应用分组监听回调 ```javascript import stats from '@ohos.bundleState' - + //promise stats.unRegisterGroupCallBack().then( () => { console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.'); 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 8515aec21d..e33520c69a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deviceUsageStatistics.md @@ -982,7 +982,7 @@ FA卡片的使用信息的属性集合。 | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| formName | number | 是 | 卡片名称。| +| formName | string | 是 | 卡片名称。| | formDimension | number | 是 | 卡片尺寸。| | formId | number | 是 | 卡片Id。| | formLastUsedTime | number | 是 | 卡片的上一次点击时间。| -- GitLab