Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b73b7fd6
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b73b7fd6
编写于
3月 30, 2022
作者:
O
openharmony_ci
提交者:
Gitee
3月 30, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2840 2560 处理完成:设备使用信息统计相关文档更新
Merge pull request !2840 from ester.zhou/TR-2560
上级
fb7867de
b4fb9847
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
39 addition
and
39 deletion
+39
-39
en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
...ice-usage-statistics/device-usage-statistics-dev-guide.md
+20
-20
en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
...ation-dev/reference/apis/js-apis-deviceUsageStatistics.md
+19
-19
未找到文件。
en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
浏览文件 @
b73b7fd6
...
@@ -56,14 +56,14 @@ import stats from '@ohos.bundleState';
...
@@ -56,14 +56,14 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.queryBundleActiveStates(0, 20000000000000, (err, res) => {
stats.queryBundleActiveStates(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback success.');
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -77,7 +77,7 @@ import stats from '@ohos.bundleState';
...
@@ -77,7 +77,7 @@ import stats from '@ohos.bundleState';
stats.queryBundleStateInfos(0, 20000000000000).then( res => {
stats.queryBundleStateInfos(0, 20000000000000).then( res => {
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.');
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.');
let i = 1;
let i = 1;
for(let key in res){
for
(let key in res){
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise number : ' + i);
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise number : ' + i);
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise result ' + JSON.stringify(res[key]));
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise result ' + JSON.stringify(res[key]));
i++;
i++;
...
@@ -88,7 +88,9 @@ import stats from '@ohos.bundleState';
...
@@ -88,7 +88,9 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.queryBundleStateInfos(0, 20000000000000, (err, res) => {
stats.queryBundleStateInfos(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback success.');
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback success.');
let i = 1;
let i = 1;
for(let key in res){
for(let key in res){
...
@@ -96,8 +98,6 @@ import stats from '@ohos.bundleState';
...
@@ -96,8 +98,6 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback result ' + JSON.stringify(res[key]));
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback result ' + JSON.stringify(res[key]));
i++;
i++;
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -120,14 +120,14 @@ import stats from '@ohos.bundleState';
...
@@ -120,14 +120,14 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.queryCurrentBundleActiveStates(0, 20000000000000, (err, res) => {
stats.queryCurrentBundleActiveStates(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback success.');
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -150,14 +150,14 @@ import stats from '@ohos.bundleState';
...
@@ -150,14 +150,14 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.queryBundleStateInfoByInterval(0, 0, 20000000000000, (err, res) => {
stats.queryBundleStateInfoByInterval(0, 0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback success.');
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -176,10 +176,10 @@ import stats from '@ohos.bundleState';
...
@@ -176,10 +176,10 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.queryAppUsagePriorityGroup((err, res) => {
stats.queryAppUsagePriorityGroup((err, res) => {
if(err.code === 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
} else {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
}
}
});
});
```
```
...
@@ -198,10 +198,10 @@ import stats from '@ohos.bundleState';
...
@@ -198,10 +198,10 @@ import stats from '@ohos.bundleState';
// Use an asynchronous callback to return the result.
// Use an asynchronous callback to return the result.
stats.isIdleState("com.ohos.camera", (err, res) => {
stats.isIdleState("com.ohos.camera", (err, res) => {
if(err.code === 0) {
if (err) {
console.log('BUNDLE_ACTIVE isIdleState callback succeeded, result: ' + JSON.stringify(res));
} else {
console.log('BUNDLE_ACTIVE isIdleState callback failed, because: ' + err.code);
console.log('BUNDLE_ACTIVE isIdleState callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE isIdleState callback succeeded, result: ' + JSON.stringify(res));
}
}
});
});
```
```
en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
浏览文件 @
b73b7fd6
...
@@ -29,10 +29,10 @@ Checks whether the application specified by **bundleName** is in the idle state.
...
@@ -29,10 +29,10 @@ Checks whether the application specified by **bundleName** is in the idle state.
```
```
bundleState.isIdleState("com.ohos.camera", (err, res) => {
bundleState.isIdleState("com.ohos.camera", (err, res) => {
if(err.code === 0) {
if (err) {
console.log('BUNDLE_ACTIVE isIdleState callback succeeded, result: ' + JSON.stringify(res));
} else {
console.log('BUNDLE_ACTIVE isIdleState callback failed, because: ' + err.code);
console.log('BUNDLE_ACTIVE isIdleState callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE isIdleState callback succeeded, result: ' + JSON.stringify(res));
}
}
});
});
```
```
...
@@ -85,10 +85,10 @@ Queries the priority group of the current invoker application. This API uses an
...
@@ -85,10 +85,10 @@ Queries the priority group of the current invoker application. This API uses an
```
```
bundleState.queryAppUsagePriorityGroup((err, res) => {
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err.code === 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
} else {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
}
}
});
});
```
```
...
@@ -139,7 +139,9 @@ Queries the application usage duration statistics based on the specified start t
...
@@ -139,7 +139,9 @@ Queries the application usage duration statistics based on the specified start t
```
```
bundleState.queryBundleStateInfos(0, 20000000000000, (err, res) => {
bundleState.queryBundleStateInfos(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback success.');
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback success.');
let i = 1;
let i = 1;
for(let key in res){
for(let key in res){
...
@@ -147,8 +149,6 @@ Queries the application usage duration statistics based on the specified start t
...
@@ -147,8 +149,6 @@ Queries the application usage duration statistics based on the specified start t
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback result ' + JSON.stringify(res[key]));
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback result ' + JSON.stringify(res[key]));
i++;
i++;
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfos callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -215,14 +215,14 @@ Queries the application usage duration statistics in the specified time frame at
...
@@ -215,14 +215,14 @@ Queries the application usage duration statistics in the specified time frame at
```
```
bundleState.queryBundleStateInfoByInterval(0, 0, 20000000000000, (err, res) => {
bundleState.queryBundleStateInfoByInterval(0, 0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback success.');
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -287,14 +287,14 @@ Queries events of all applications based on the specified start time and end tim
...
@@ -287,14 +287,14 @@ Queries events of all applications based on the specified start time and end tim
```
```
bundleState.queryBundleActiveStates(0, 20000000000000, (err, res) => {
bundleState.queryBundleActiveStates(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback success.');
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryBundleActiveStates callback failed, because: ' + err.code);
}
}
});
});
```
```
...
@@ -356,14 +356,14 @@ Queries events of this application based on the specified start time and end tim
...
@@ -356,14 +356,14 @@ Queries events of this application based on the specified start time and end tim
```
```
bundleState.queryCurrentBundleActiveStates(0, 20000000000000, (err, res) => {
bundleState.queryCurrentBundleActiveStates(0, 20000000000000, (err, res) => {
if(err.code == 0) {
if (err) {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback success.');
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback success.');
for (let i = 0; i < res.length; i++) {
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback result ' + JSON.stringify(res[i]));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback result ' + JSON.stringify(res[i]));
}
}
} else {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates callback failed, because: ' + err.code);
}
}
});
});
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录