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