Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
0ffe99c3
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看板
未验证
提交
0ffe99c3
编写于
6月 19, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 19, 2023
浏览文件
操作
浏览文件
下载
差异文件
!19693 【EDM】修改示例代码
Merge pull request !19693 from 李兀立/master
上级
feb822e6
416ec750
变更
11
展开全部
隐藏空白更改
内联
并排
Showing
11 changed file
with
755 addition
and
642 deletion
+755
-642
zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
...reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
+5
-5
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md
...n-dev/reference/apis/js-apis-enterprise-accountManager.md
+15
-11
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md
...ion-dev/reference/apis/js-apis-enterprise-adminManager.md
+162
-140
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
...v/reference/apis/js-apis-enterprise-applicationManager.md
+75
-62
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
...on-dev/reference/apis/js-apis-enterprise-bundleManager.md
+261
-228
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
...-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
+46
-31
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md
...on-dev/reference/apis/js-apis-enterprise-deviceControl.md
+14
-10
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md
...ation-dev/reference/apis/js-apis-enterprise-deviceInfo.md
+45
-39
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceSetings.md
...on-dev/reference/apis/js-apis-enterprise-deviceSetings.md
+15
-13
zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md
...n-dev/reference/apis/js-apis-enterprise-networkManager.md
+80
-70
zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
...tion-dev/reference/apis/js-apis-enterprise-wifiManager.md
+37
-33
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
浏览文件 @
0ffe99c3
...
...
@@ -75,7 +75,7 @@ onBundleAdded(bundleName: string): void
```
ts
export
default
class
EnterpriseAdminAbility
extends
EnterpriseAdminExtensionAbility
{
onBundleAdded
(
bundleName
:
string
)
{
console
.
log
(
"
added bundle name:
"
+
bundleName
);
console
.
info
(
`Succeeded in calling onBundleAdded callback, added bundle name :
${
bundleName
}
`
);
}
};
```
...
...
@@ -100,8 +100,8 @@ onBundleRemoved(bundleName: string): void
```
ts
export
default
class
EnterpriseAdminAbility
extends
EnterpriseAdminExtensionAbility
{
onBundle
Add
ed
(
bundleName
:
string
)
{
console
.
log
(
"
removed bundle name:
"
+
bundleName
);
onBundle
Remov
ed
(
bundleName
:
string
)
{
console
.
info
(
`Succeeded in calling onBundleRemoved callback, removed bundle name :
${
bundleName
}
`
);
}
};
```
...
...
@@ -127,7 +127,7 @@ onAppStart(bundleName: string): void
```
ts
export
default
class
EnterpriseAdminAbility
extends
EnterpriseAdminExtensionAbility
{
onAppStart
(
bundleName
:
string
)
{
console
.
log
(
"
started bundle name:
"
+
bundleName
);
console
.
info
(
`Succeeded in calling onAppStart callback, started bundle name :
${
bundleName
}
`
);
}
};
```
...
...
@@ -153,7 +153,7 @@ onAppStop(bundleName: string): void
```
ts
export
default
class
EnterpriseAdminAbility
extends
EnterpriseAdminExtensionAbility
{
onAppStop
(
bundleName
:
string
)
{
console
.
log
(
"
stopped bundle name:
"
+
bundleName
);
console
.
info
(
`Succeeded in calling onAppStop callback, stopped bundle name :
${
bundleName
}
`
);
}
};
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md
浏览文件 @
0ffe99c3
...
...
@@ -46,13 +46,16 @@ disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback&
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
accountManager
.
disallowAddLocalAccount
(
wantTemp
,
true
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
accountManager
.
disallowAddLocalAccount
(
wantTemp
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to disallow add local account. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in disallowing add local account
'
);
});
```
...
...
@@ -94,12 +97,13 @@ disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
accountManager
.
disallowAddLocalAccount
(
wantTemp
,
true
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in disallowing add local account
'
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to disallow add local account. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md
浏览文件 @
0ffe99c3
...
...
@@ -47,19 +47,20 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
name
:
"
enterprise name
"
,
description
:
"
enterprise description
"
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_SUPER
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
enableAdmin success
"
);
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_SUPER
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to enable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in enabling admin
'
);
});
```
...
...
@@ -99,19 +100,20 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
name
:
"
enterprise name
"
,
description
:
"
enterprise description
"
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
enableAdmin success
"
);
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to enable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in enabling admin
'
);
});
```
...
...
@@ -156,16 +158,16 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
name
:
"
enterprise name
"
,
description
:
"
enterprise description
"
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
)
.
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
).
catch
((
err
)
=>
{
console
.
error
(
`Failed to enable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -200,15 +202,16 @@ disableAdmin(admin: Want, callback: AsyncCallback\<void>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
disableAdmin
(
wantTemp
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
disableAdmin success
"
);
adminManager
.
disableAdmin
(
wantTemp
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to disable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in disabling admin
'
);
});
```
...
...
@@ -244,15 +247,16 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
disableAdmin
(
wantTemp
,
100
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
disableAdmin success
"
);
adminManager
.
disableAdmin
(
wantTemp
,
100
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to disable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in disabling admin
'
);
});
```
...
...
@@ -293,11 +297,12 @@ disableAdmin(admin: Want, userId?: number): Promise\<void>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
disableAdmin
(
wantTemp
,
100
).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
adminManager
.
disableAdmin
(
wantTemp
,
100
).
catch
((
err
)
=>
{
console
.
error
(
`Failed to disable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -331,13 +336,14 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void
**示例**
:
```
js
let
bundleName
=
"
com.example.myapplication
"
;
adminManager
.
disableSuperAdmin
(
bundleName
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
disableSuperAdmin success
"
);
let
bundleName
=
'
com.example.myapplication
'
;
adminManager
.
disableSuperAdmin
(
bundleName
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to disable super admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in disabling super admin
'
);
});
```
...
...
@@ -376,9 +382,10 @@ disableSuperAdmin(bundleName: String): Promise\<void>
**示例**
:
```
js
let
bundleName
=
"
com.example.myapplication
"
;
adminManager
.
disableSuperAdmin
(
bundleName
).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
let
bundleName
=
'
com.example.myapplication
'
;
adminManager
.
disableSuperAdmin
(
bundleName
).
catch
((
err
)
=>
{
console
.
error
(
`Failed to disable super admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -403,15 +410,16 @@ isAdminEnabled(admin: Want, callback: AsyncCallback\<boolean>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
isAdminEnabled
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
result is
"
+
result
);
adminManager
.
isAdminEnabled
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query admin is enabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in querying admin is enabled or not, result :
${
result
}
`
);
});
```
...
...
@@ -437,15 +445,16 @@ isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\<boolean>):
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
isAdminEnabled
(
wantTemp
,
100
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
result is
"
+
result
);
adminManager
.
isAdminEnabled
(
wantTemp
,
100
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query admin is enabled. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in querying admin is enabled or not, result :
${
result
}
`
);
});
```
...
...
@@ -476,13 +485,14 @@ isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
isAdminEnabled
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
log
(
"
result is
"
+
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
console
.
info
(
`Succeeded in querying admin is enabled or not, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to query admin is enabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -506,13 +516,14 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
**示例**
:
```
js
let
bundleName
=
"
com.example.myapplication
"
;
adminManager
.
isSuperAdmin
(
bundleName
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
result is
"
+
result
);
let
bundleName
=
'
com.example.myapplication
'
;
adminManager
.
isSuperAdmin
(
bundleName
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query admin is super admin or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in querying admin is super admin or not, result :
${
result
}
`
);
});
```
...
...
@@ -541,11 +552,12 @@ isSuperAdmin(bundleName: String): Promise\<boolean>
**示例**
:
```
js
let
bundleName
=
"
com.example.myapplication
"
;
let
bundleName
=
'
com.example.myapplication
'
;
adminManager
.
isSuperAdmin
(
bundleName
).
then
((
result
)
=>
{
console
.
log
(
"
result is
"
+
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
console
.
info
(
`Succeeded in querying admin is super admin or not, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to query admin is super admin or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -581,19 +593,20 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
name
:
"
enterprise name
"
,
description
:
"
enterprise description
"
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
,
error
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
"
setEnterpriseInfo success
"
);
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in setting enterprise info
'
);
});
```
...
...
@@ -634,15 +647,16 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\<void>;
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
name
:
"
enterprise name
"
,
description
:
"
enterprise description
"
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -675,16 +689,16 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
adminManager
.
getEnterpriseInfo
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error occurs
"
+
error
);
return
;
}
console
.
log
(
result
.
name
);
console
.
log
(
result
.
description
);
adminManager
.
getEnterpriseInfo
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
)
;
return
;
}
console
.
info
(
`Succeeded in getting enterprise info, enterprise name :
${
result
.
name
}
, enterprise description :
${
result
.
description
}
`
);
});
```
...
...
@@ -722,14 +736,14 @@ getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
adminManager
.
getEnterpriseInfo
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
result
.
name
);
console
.
log
(
result
.
description
);
}).
catch
(
error
=>
{
console
.
log
(
"
error occurs
"
+
error
);
console
.
info
(
`Succeeded in getting enterprise info, enterprise name :
${
result
.
name
}
, enterprise description :
${
result
.
description
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to get enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -766,14 +780,17 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
adminManager
.
subscribeManagedEvent
(
wantTemp
,
events
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
adminManager
.
subscribeManagedEvent
(
wantTemp
,
events
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to subscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in subscribe managed event
'
);
});
```
...
...
@@ -815,13 +832,14 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
adminManager
.
subscribeManagedEvent
(
wantTemp
,
events
).
then
(()
=>
{
}).
catch
((
err
or
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to subscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
...
...
@@ -858,14 +876,17 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callba
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
adminManager
.
unsubscribeManagedEvent
(
wantTemp
,
events
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
adminManager
.
unsubscribeManagedEvent
(
wantTemp
,
events
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to unsubscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in unsubscribe managed event
'
);
});
```
...
...
@@ -907,13 +928,14 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promi
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
adminManager
.
unsubscribeManagedEvent
(
wantTemp
,
events
).
then
(()
=>
{
}).
catch
((
err
or
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to unsubscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
浏览文件 @
0ffe99c3
...
...
@@ -47,15 +47,17 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: Async
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to add disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in adding disallowed running bundles
'
);
});
```
...
...
@@ -93,15 +95,17 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number,
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to add disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in adding disallowed running bundles
'
);
});
```
...
...
@@ -144,15 +148,15 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in adding disallowed running bundles
'
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to add disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -189,15 +193,17 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: As
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to remove disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in removing disallowed running bundles
'
);
});
```
...
...
@@ -235,15 +241,17 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: numb
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to remove disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in removing disallowed running bundles
'
);
});
```
...
...
@@ -286,15 +294,15 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: num
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
"
com.example.myapplication
"
];
let
appIds
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in removing disallowed running bundles
'
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to remove disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -330,14 +338,16 @@ getDisallowedRunningBundles(admin: Want, callback: AsyncCallback<Array<str
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting disallowed running bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
});
```
...
...
@@ -374,14 +384,16 @@ getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
100
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
100
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting disallowed running bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
});
```
...
...
@@ -423,12 +435,13 @@ getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<s
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
100
).
then
(()
=>
{
console
.
log
(
"
success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting disallowed running bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to get disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
浏览文件 @
0ffe99c3
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
浏览文件 @
0ffe99c3
...
...
@@ -46,13 +46,16 @@ setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
setDateTime
(
wantTemp
,
1526003846000
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
dateTimeManager
.
setDateTime
(
wantTemp
,
1526003846000
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in setting date time
'
);
})
```
...
...
@@ -94,12 +97,14 @@ setDateTime(admin: Want, time: number): Promise\<void>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
setDateTime
(
wantTemp
,
1526003846000
).
then
(()
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in setting date time
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -136,13 +141,16 @@ disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
disallowModifyDateTime
(
wantTemp
,
true
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
dateTimeManager
.
disallowModifyDateTime
(
wantTemp
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to disallow modify date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in disallowing modify date time
'
);
})
```
...
...
@@ -184,12 +192,14 @@ disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
disallowModifyDateTime
(
wantTemp
,
true
).
then
(()
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in disallowing modify date time
'
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to disallow modify date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -225,13 +235,16 @@ isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
isModifyDateTimeDisallowed
(
wantTemp
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
dateTimeManager
.
isModifyDateTimeDisallowed
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query modify date time is disallowed or not. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in querying modify date time is disallowed :
${
result
}
`
);
})
```
...
...
@@ -272,11 +285,13 @@ isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
isModifyDateTimeDisallowed
(
wantTemp
).
then
(()
=>
{
}).
catch
((
error
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
dateTimeManager
.
isModifyDateTimeDisallowed
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying modify date time is disallowed :
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to query modify date time is disallowed or not. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md
浏览文件 @
0ffe99c3
...
...
@@ -45,13 +45,16 @@ resetFactory(admin: Want, callback: AsyncCallback\<void>): void
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
deviceControl
.
resetFactory
(
wantTemp
,
(
error
)
=>
{
if
(
error
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}
deviceControl
.
resetFactory
(
wantTemp
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to reset factory. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
console
.
log
(
'
Succeeded in resetting factory
'
);
})
```
...
...
@@ -92,11 +95,12 @@ resetFactory(admin: Want): Promise\<void>
```
js
let
wantTemp
=
{
bundleName
:
"
bundleName
"
,
abilityName
:
"
abilityName
"
,
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
deviceControl
.
resetFactory
(
wantTemp
).
then
(()
=>
{
}).
catch
((
err
or
)
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to reset factory. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md
浏览文件 @
0ffe99c3
...
...
@@ -45,15 +45,16 @@ getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceSerial
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
deviceInfo
.
getDeviceSerial
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get device serial. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting device serial, result :
${
result
}
`
);
});
```
...
...
@@ -94,13 +95,14 @@ getDeviceSerial(admin: Want): Promise<string>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceSerial
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in getting device serial, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to get device serial. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -136,15 +138,16 @@ getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void;
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDisplayVersion
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
deviceInfo
.
getDisplayVersion
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get display version. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting display version, result :
${
result
}
`
);
});
```
...
...
@@ -185,13 +188,14 @@ getDisplayVersion(admin: Want): Promise<string>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDisplayVersion
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in getting display version, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to get display version. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -227,15 +231,16 @@ getDeviceName(admin: Want, callback: AsyncCallback<string>): void
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceName
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
deviceInfo
.
getDeviceName
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get device name. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting device name, result :
${
result
}
`
);
});
```
...
...
@@ -276,12 +281,13 @@ getDeviceName(admin: Want): Promise<string>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceName
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in getting device name, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to get device name. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceSetings.md
浏览文件 @
0ffe99c3
...
...
@@ -44,15 +44,16 @@ getScreenOffTime(admin: Want, callback: AsyncCallback<number>): void
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceSettings
.
getScreenOffTime
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
deviceSettings
.
getScreenOffTime
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get screen off time. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting screen off time, result :
${
result
}
`
);
});
```
...
...
@@ -93,12 +94,13 @@ getScreenOffTime(admin: Want): Promise<number>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceSettings
.
getScreenOffTime
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in getting screen off time, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to get screen off time. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md
浏览文件 @
0ffe99c3
...
...
@@ -45,15 +45,16 @@ getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string&
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getAllNetworkInterfaces
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
JSON
.
stringify
(
result
));
networkManager
.
getAllNetworkInterfaces
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get all network interfaces. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting all network interfaces, result :
${
JSON
.
stringify
(
result
)}
`
);
});
```
...
...
@@ -94,13 +95,14 @@ getAllNetworkInterfaces(admin: Want): Promise<Array<string>>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getAllNetworkInterfaces
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
JSON
.
stringify
(
result
)
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in getting all network interfaces, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to get all network interfaces. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -137,15 +139,16 @@ getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<s
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getIpAddress
(
wantTemp
,
"
eth0
"
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
networkManager
.
getIpAddress
(
wantTemp
,
'
eth0
'
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get ip address. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting ip address, result :
${
result
}
`
);
});
```
...
...
@@ -187,13 +190,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise<string>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getIpAddress
(
wantTemp
,
"
eth0
"
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
networkManager
.
getIpAddress
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting ip address, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to get ip address. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -230,21 +234,22 @@ getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string&
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getMac
(
wantTemp
,
"
eth0
"
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
result
);
networkManager
.
getMac
(
wantTemp
,
'
eth0
'
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to get mac. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in getting mac, result :
${
result
}
`
);
});
```
## networkManager.getMac
get
IpAddress(admin: Want, networkInterface: string): Promise
<
string
>
;
get
Mac(admin: Want, networkInterface: string): Promise
\<
string>
;
指定设备管理员应用根据networkInterface获取设备MAC地址,使用Promise形式返回设备IP地址。
...
...
@@ -280,13 +285,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise<string>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getMac
(
wantTemp
,
"
eth0
"
).
then
((
result
)
=>
{
console
.
log
(
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
networkManager
.
getMac
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting mac, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to get mac. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -323,15 +329,16 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: Asyn
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
isNetworkInterfaceDisabled
(
wantTemp
,
"
eth0
"
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
"
result:
"
+
result
);
networkManager
.
isNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query network interface is disabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in querying network interface is disabled or not, result :
${
result
}
`
);
});
```
...
...
@@ -373,13 +380,14 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<bo
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
isNetworkInterfaceDisabled
(
wantTemp
,
"
eth0
"
).
then
((
result
)
=>
{
console
.
log
(
"
result:
"
+
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
networkManager
.
isNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying network interface is disabled or not, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to query network interface is disabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -417,15 +425,16 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
setNetworkInterfaceDisabled
(
wantTemp
,
"
eth0
"
,
true
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
"
setNetworkInterfaceDisabled success!
"
);
networkManager
.
setNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
,
true
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set network interface disabled. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in setting network interface disabled`
);
});
```
...
...
@@ -468,12 +477,13 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
setNetworkInterfaceDisabled
(
wantTemp
,
"
eth0
"
,
true
).
then
(()
=>
{
console
.
log
(
"
setNetworkInterfaceDisabled success!
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
networkManager
.
setNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
,
true
).
then
(()
=>
{
console
.
info
(
`Succeeded in setting network interface disabled`
);
}).
catch
((
err
)
=>
{
console
.
error
(
`Failed to set network interface disabled. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
浏览文件 @
0ffe99c3
...
...
@@ -45,15 +45,16 @@ isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
wifiManager
.
isWifiActive
(
wantTemp
,
(
error
,
result
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
"
result:
"
+
result
);
wifiManager
.
isWifiActive
(
wantTemp
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to query is wifi active or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
`Succeeded in query is wifi active or not, result :
${
result
}
`
);
});
```
...
...
@@ -94,13 +95,14 @@ isWifiActive(admin: Want): Promise<boolean>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
wifiManager
.
isWifiActive
(
wantTemp
).
then
((
result
)
=>
{
console
.
log
(
"
result:
"
+
result
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
`Succeeded in query is wifi active or not, result :
${
result
}
`
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to query is wifi active or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -137,20 +139,21 @@ setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback<voi
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
profile
:
wifiManager
.
WifiProfile
=
{
"
ssid
"
:
"
name
"
,
"
preSharedKey
"
:
"
passwd
"
,
"
securityType
"
:
wifiManager
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
let
profile
:
wifiManager
.
WifiProfile
=
{
'
ssid
'
:
'
name
'
,
'
preSharedKey
'
:
'
passwd
'
,
'
securityType
'
:
wifiManager
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
};
wifiManager
.
setWifiProfile
(
wantTemp
,
profile
,
(
error
)
=>
{
if
(
error
!=
null
)
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
return
;
}
console
.
log
(
"
set wifi success
"
);
wifiManager
.
setWifiProfile
(
wantTemp
,
profile
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to set wifi profile. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
info
(
'
Succeeded in setting wifi profile
'
);
});
```
...
...
@@ -192,18 +195,19 @@ setWifiProfile(admin: Want, profile: WifiProfile): Promise<void>
```
js
let
wantTemp
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
,
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
profile
:
wifiManager
.
WifiProfile
=
{
"
ssid
"
:
"
name
"
,
"
preSharedKey
"
:
"
passwd
"
,
"
securityType
"
:
wifiManager
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
'
ssid
'
:
'
name
'
,
'
preSharedKey
'
:
'
passwd
'
,
'
securityType
'
:
wifiManager
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
};
wifiManager
.
setWifiProfile
(
wantTemp
,
profile
).
then
(()
=>
{
console
.
log
(
"
set wifi success
"
);
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
info
(
'
Succeeded in setting wifi profile
'
);
}).
catch
(
(
err
)
=>
{
console
.
error
(
`Failed to set wifi profile. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录