Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
e13c2372
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
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看板
提交
e13c2372
编写于
8月 28, 2023
作者:
L
liwuli
提交者:
李兀立
8月 29, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fixed
c005aa92
from
https://gitee.com/Liwuli123/docs/pulls/23273
arkts整改 Signed-off-by:
N
liwuli
<
liwuli@huawei.com
>
上级
47addc6b
变更
13
隐藏空白更改
内联
并排
Showing
13 changed file
with
603 addition
and
415 deletion
+603
-415
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md
...n-dev/reference/apis/js-apis-enterprise-accountManager.md
+9
-6
zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md
...ion-dev/reference/apis/js-apis-enterprise-adminManager.md
+104
-68
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
...v/reference/apis/js-apis-enterprise-applicationManager.md
+48
-36
zh-cn/application-dev/reference/apis/js-apis-enterprise-browser.md
...lication-dev/reference/apis/js-apis-enterprise-browser.md
+17
-11
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
...on-dev/reference/apis/js-apis-enterprise-bundleManager.md
+158
-112
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
...-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
+26
-17
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md
...on-dev/reference/apis/js-apis-enterprise-deviceControl.md
+10
-7
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md
...ation-dev/reference/apis/js-apis-enterprise-deviceInfo.md
+25
-16
zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceSettings.md
...n-dev/reference/apis/js-apis-enterprise-deviceSettings.md
+49
-38
zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md
...n-dev/reference/apis/js-apis-enterprise-networkManager.md
+93
-61
zh-cn/application-dev/reference/apis/js-apis-enterprise-restrictions.md
...ion-dev/reference/apis/js-apis-enterprise-restrictions.md
+34
-22
zh-cn/application-dev/reference/apis/js-apis-enterprise-usbManager.md
...ation-dev/reference/apis/js-apis-enterprise-usbManager.md
+12
-9
zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
...tion-dev/reference/apis/js-apis-enterprise-wifiManager.md
+18
-12
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
accountManager
from
'
@ohos.enterprise.accountManager
'
;
```
...
...
@@ -47,8 +47,9 @@ disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback&
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -98,15 +99,17 @@ disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
accountManager
.
disallowAddLocalAccount
(
wantTemp
,
true
).
then
(()
=>
{
console
.
info
(
'
Succeeded in disallowing add local account
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
adminManager
from
'
@ohos.enterprise.adminManager
'
;
```
...
...
@@ -49,12 +49,13 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
let
enterpriseInfo
:
adminManager
.
EnterpriseInfo
=
{
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
...
...
@@ -102,12 +103,13 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
let
enterpriseInfo
:
adminManager
.
EnterpriseInfo
=
{
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
...
...
@@ -160,19 +162,22 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
let
enterpriseInfo
:
adminManager
.
EnterpriseInfo
=
{
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
).
catch
((
err
)
=>
{
console
.
error
(
`Failed to enable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
adminManager
.
enableAdmin
(
wantTemp
,
enterpriseInfo
,
adminManager
.
AdminType
.
ADMIN_TYPE_NORMAL
,
100
).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to enable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
## adminManager.disableAdmin
...
...
@@ -204,8 +209,9 @@ disableAdmin(admin: Want, callback: AsyncCallback\<void>): void
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -249,8 +255,9 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -299,13 +306,15 @@ disableAdmin(admin: Want, userId?: number): Promise\<void>
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
disableAdmin
(
wantTemp
,
100
).
catch
((
err
)
=>
{
adminManager
.
disableAdmin
(
wantTemp
,
100
).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to disable admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -339,8 +348,9 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void
**示例**
:
```
js
let
bundleName
=
'
com.example.myapplication
'
;
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
bundleName
:
string
=
'
com.example.myapplication
'
;
adminManager
.
disableSuperAdmin
(
bundleName
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -385,10 +395,12 @@ disableSuperAdmin(bundleName: String): Promise\<void>
**示例**
:
```
js
let
bundleName
=
'
com.example.myapplication
'
;
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
:
string
=
'
com.example.myapplication
'
;
adminManager
.
disableSuperAdmin
(
bundleName
).
catch
((
err
)
=>
{
adminManager
.
disableSuperAdmin
(
bundleName
).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to disable super admin. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -412,8 +424,9 @@ isAdminEnabled(admin: Want, callback: AsyncCallback\<boolean>): void
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -447,8 +460,9 @@ isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\<boolean>):
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -487,15 +501,17 @@ isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>
**示例**
:
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
adminManager
.
isAdminEnabled
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying admin is enabled or not, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query admin is enabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -519,8 +535,9 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void
**示例**
:
```
js
let
bundleName
=
'
com.example.myapplication
'
;
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
bundleName
:
string
=
'
com.example.myapplication
'
;
adminManager
.
isSuperAdmin
(
bundleName
,
(
err
,
result
)
=>
{
if
(
err
)
{
...
...
@@ -555,12 +572,14 @@ isSuperAdmin(bundleName: String): Promise\<boolean>
**示例**
:
```
js
let
bundleName
=
'
com.example.myapplication
'
;
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
:
string
=
'
com.example.myapplication
'
;
adminManager
.
isSuperAdmin
(
bundleName
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying admin is super admin or not, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query admin is super admin or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -595,12 +614,13 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
let
enterpriseInfo
:
adminManager
.
EnterpriseInfo
=
{
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
...
...
@@ -649,17 +669,19 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\<void>;
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
enterpriseInfo
=
{
let
enterpriseInfo
:
adminManager
.
EnterpriseInfo
=
{
name
:
'
enterprise name
'
,
description
:
'
enterprise description
'
}
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
).
catch
((
err
)
=>
{
adminManager
.
setEnterpriseInfo
(
wantTemp
,
enterpriseInfo
).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -691,8 +713,9 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -738,15 +761,17 @@ getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
adminManager
.
getEnterpriseInfo
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting enterprise info, enterprise name :
${
result
.
name
}
, enterprise description :
${
result
.
description
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get enterprise info. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -782,12 +807,13 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
let
events
:
Array
<
adminManager
.
ManagedEvent
>
=
[
0
,
1
];
adminManager
.
subscribeManagedEvent
(
wantTemp
,
events
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -834,15 +860,17 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
let
events
:
Array
<
adminManager
.
ManagedEvent
>
=
[
0
,
1
];
adminManager
.
subscribeManagedEvent
(
wantTemp
,
events
).
then
(()
=>
{
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to subscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
...
...
@@ -878,12 +906,13 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callba
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
let
events
:
Array
<
adminManager
.
ManagedEvent
>
=
[
0
,
1
];
adminManager
.
unsubscribeManagedEvent
(
wantTemp
,
events
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -930,15 +959,17 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promi
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
events
=
[
0
,
1
];
let
events
:
Array
<
adminManager
.
ManagedEvent
>
=
[
0
,
1
];
adminManager
.
unsubscribeManagedEvent
(
wantTemp
,
events
).
then
(()
=>
{
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to unsubscribe managed event. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
...
...
@@ -975,12 +1006,14 @@ authorizeAdmin(admin: Want, bundleName: string, callback: AsyncCallback<void&
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
bundleName
:
string
=
"
com.example.application
"
;
adminManager
.
authorizeAdmin
(
wantTemp
,
bundleName
,
(
err
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to authorize permission to the application. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
...
@@ -1027,14 +1060,17 @@ authorizeAdmin(admin: Want, bundleName: string): Promise<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
bundleName
:
string
=
"
com.example.application
"
;
adminManager
.
authorizeAdmin
(
wantTemp
,
bundleName
).
then
(()
=>
{
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to authorize permission to the application. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
applicationManager
from
'
@ohos.enterprise.applicationManager
'
;
```
...
...
@@ -48,12 +48,13 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: Async
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -96,12 +97,13 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number,
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -149,17 +151,19 @@ addDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
addDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
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
}
`
);
console
.
info
(
'
Succeeded in adding disallowed running bundles
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to add disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -194,12 +198,13 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: As
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -242,12 +247,13 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: numb
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -295,17 +301,19 @@ removeDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: num
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
applicationManager
.
removeDisallowedRunningBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
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
}
`
);
console
.
info
(
'
Succeeded in removing disallowed running bundles
'
);
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove disallowed running bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -339,8 +347,9 @@ getDisallowedRunningBundles(admin: Want, callback: AsyncCallback<Array<str
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -385,8 +394,9 @@ getDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -436,15 +446,17 @@ getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<s
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
applicationManager
.
getDisallowedRunningBundles
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting disallowed running bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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-browser.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
browser
from
'
@ohos.enterprise.browser
'
;
```
...
...
@@ -48,8 +48,9 @@ setPolicies(admin: Want, appId: string, policies: string, callback: AsyncCallbac
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -101,8 +102,10 @@ setPolicies(admin: Want, appId: string, policies: string): Promise<void>;
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -110,7 +113,7 @@ let appId: string = 'com.example.myapplication';
let
policies
:
string
=
'
{"InsecurePrivateNetworkRequestsAllowed":{"level":"mandatory","scope":"machine","source":"platform","value":true},"LegacySameSiteCookieBehaviorEnabledForDomainList":{"level":"mandatory","scope":"machine","source":"platform","value":["[*.]"]}}
'
browser
.
setPolicies
(
wantTemp
,
appId
,
policies
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting browser policies
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set browser policies. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -143,8 +146,9 @@ getPolicies(admin: Want, appId: string, callback: AsyncCallback<string>):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -191,15 +195,17 @@ getPolicies(admin: Want, appId: string): Promise<string>;
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appId
:
string
=
'
com.example.myapplication
'
;
browser
.
getPolicies
(
wantTemp
,
appId
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting browser policies, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get browser policies. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
bundleManager
from
'
@ohos.enterprise.bundleManager
'
;
```
...
...
@@ -47,12 +47,13 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCal
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addAllowedInstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -95,12 +96,13 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number, ca
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addAllowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -148,16 +150,18 @@ addAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addAllowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in adding allowed install bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to add allowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -193,12 +197,13 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeAllowedInstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -241,12 +246,13 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeAllowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -294,16 +300,18 @@ removeAllowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeAllowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in removing allowed install bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove allowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -338,8 +346,9 @@ getAllowedInstallBundles(admin: Want, callback: AsyncCallback<Array<string
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -384,8 +393,9 @@ getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback<
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -435,15 +445,17 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<stri
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
bundleManager
.
getAllowedInstallBundles
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting allowed install bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get allowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -479,12 +491,13 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: Async
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedInstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -527,12 +540,13 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: number,
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -580,16 +594,18 @@ addDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: number
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in adding disallowed install bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to add disallowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -625,12 +641,13 @@ removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, callback: As
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -673,12 +690,13 @@ removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId: numb
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -726,16 +744,18 @@ removeDisallowedInstallBundles(admin: Want, appIds: Array\<string>, userId?: num
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedInstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in removing disallowed install bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove disallowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -770,8 +790,9 @@ getDisallowedInstallBundles(admin: Want, callback: AsyncCallback<Array<str
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -816,10 +837,11 @@ getDisallowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
bundleManager
.
getDisallowedInstallBundles
(
wantTemp
,
100
,
(
err
,
result
)
=>
{
...
...
@@ -867,15 +889,17 @@ getDisallowedInstallBundles(admin: Want, userId?: number): Promise<Array<s
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
bundleManager
.
getDisallowedInstallBundles
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting disallowed install bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get disallowed install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -911,12 +935,13 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: Asy
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedUninstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -959,12 +984,13 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: numbe
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedUninstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -1012,16 +1038,18 @@ addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: numb
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
addDisallowedUninstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in adding disallowed uninstall bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to add disallowed uninstall bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -1057,12 +1085,13 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback:
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedUninstallBundles
(
wantTemp
,
appIds
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -1105,12 +1134,13 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: nu
**示例:**
```
js
let
wantTemp
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedUninstallBundles
(
wantTemp
,
appIds
,
100
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -1158,16 +1188,18 @@ removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: n
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
appIds
=
[
'
com.example.myapplication
'
];
let
appIds
:
Array
<
string
>
=
[
'
com.example.myapplication
'
];
bundleManager
.
removeDisallowedUninstallBundles
(
wantTemp
,
appIds
,
100
).
then
(()
=>
{
console
.
info
(
'
Succeeded in removing disallowed uninstall bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove disallowed uninstall bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -1202,8 +1234,9 @@ getDisallowedUninstallBundles(admin: Want, callback: AsyncCallback<Array<s
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1248,8 +1281,9 @@ getDisallowedUninstallBundles(admin: Want, userId: number, callback: AsyncCallba
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1299,15 +1333,17 @@ getDisallowedUninstallBundles(admin: Want, userId?: number): Promise<Array<
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
bundleManager
.
getDisallowedUninstallBundles
(
wantTemp
,
100
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting disallowed uninstall bundles, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get disallowed uninstall bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -1343,8 +1379,9 @@ uninstall(admin: Want, bundleName: string, callback: AsyncCallback<void>):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1389,8 +1426,9 @@ uninstall(admin: Want, bundleName: string, userId: number, callback: AsyncCallba
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1435,8 +1473,9 @@ uninstall(admin: Want, bundleName: string, isKeepData: boolean, callback: AsyncC
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1482,8 +1521,9 @@ uninstall(admin: Want, bundleName: string, userId: number, isKeepData: boolean,
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1534,15 +1574,17 @@ uninstall(admin: Want, bundleName: string, userId?: number, isKeepData?: boolean
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
bundleManager
.
uninstall
(
wantTemp
,
'
bundleName
'
,
100
,
true
).
then
(()
=>
{
console
.
info
(
'
Succeeded in uninstalling bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to uninstall bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
@@ -1579,12 +1621,13 @@ install(admin: Want, hapFilePaths: Array\<string>, callback: AsyncCallback\<void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
hapFilePaths
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
let
hapFilePaths
:
Array
<
string
>
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
bundleManager
.
install
(
wantTemp
,
hapFilePaths
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -1627,13 +1670,14 @@ install(admin: Want, hapFilePaths: Array\<string>, installParam: InstallParam, c
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
hapFilePaths
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
let
installParam
=
{
let
hapFilePaths
:
Array
<
string
>
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
let
installParam
:
bundleManager
.
InstallParam
=
{
userId
:
100
,
installFlag
:
1
,
};
...
...
@@ -1684,16 +1728,18 @@ install(admin: Want, hapFilePaths: Array\<string>, installParam?: InstallParam):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
hapFilePaths
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
let
hapFilePaths
:
Array
<
string
>
=
[
'
/data/storage/el2/base/haps/entry/testinstall/ExtensionTest.hap
'
]
bundleManager
.
install
(
wantTemp
,
hapFilePaths
).
then
(()
=>
{
console
.
info
(
'
Succeeded in installing bundles
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to install bundles. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md
浏览文件 @
e13c2372
...
...
@@ -12,8 +12,8 @@
## 导入模块
```
j
s
import
dateTimeManager
from
'
@ohos.enterprise.dateTimeManager
'
```
t
s
import
dateTimeManager
from
'
@ohos.enterprise.dateTimeManager
'
;
```
## dateTimeManager.setDateTime
...
...
@@ -47,8 +47,9 @@ setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -98,15 +99,17 @@ setDateTime(admin: Want, time: number): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
setDateTime
(
wantTemp
,
1526003846000
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting date time
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -142,8 +145,9 @@ disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\<
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -193,15 +197,17 @@ disallowModifyDateTime(admin: Want, disallow: boolean): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
disallowModifyDateTime
(
wantTemp
,
true
).
then
(()
=>
{
console
.
info
(
'
Succeeded in disallowing modify date time
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to disallow modify date time. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -236,8 +242,9 @@ isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\<boolean>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -286,15 +293,17 @@ isModifyDateTimeDisallowed(admin: Want): Promise\<boolean>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
dateTimeManager
.
isModifyDateTimeDisallowed
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying modify date time is disallowed :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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
浏览文件 @
e13c2372
...
...
@@ -12,8 +12,8 @@
## 导入模块
```
j
s
import
deviceControl
from
'
@ohos.enterprise.deviceControl
'
```
t
s
import
deviceControl
from
'
@ohos.enterprise.deviceControl
'
;
```
## deviceControl.resetFactory
...
...
@@ -46,8 +46,9 @@ resetFactory(admin: Want, callback: AsyncCallback\<void>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -96,14 +97,16 @@ resetFactory(admin: Want): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
deviceControl
.
resetFactory
(
wantTemp
).
then
(()
=>
{
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
deviceInfo
from
'
@ohos.enterprise.deviceInfo
'
;
```
...
...
@@ -46,8 +46,9 @@ getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -96,15 +97,17 @@ getDeviceSerial(admin: Want): Promise<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceSerial
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting device serial, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get device serial. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -139,8 +142,9 @@ getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void;
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -189,15 +193,17 @@ getDisplayVersion(admin: Want): Promise<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDisplayVersion
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting display version, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get display version. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -232,8 +238,9 @@ getDeviceName(admin: Want, callback: AsyncCallback<string>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -282,15 +289,17 @@ getDeviceName(admin: Want): Promise<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceInfo
.
getDeviceName
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting device name, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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-deviceSettings.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
deviceSettings
from
'
@ohos.enterprise.deviceSettings
'
;
```
...
...
@@ -46,8 +46,9 @@ getScreenOffTime(admin: Want, callback: AsyncCallback<number>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -96,15 +97,17 @@ getScreenOffTime(admin: Want): Promise<number>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
deviceSettings
.
getScreenOffTime
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting screen off time, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get screen off time. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -141,30 +144,31 @@ installUserCertificate(admin: Want, certificate: CertBlob, callback: AsyncCallba
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
var
certFileArray
:
Uint8Array
;
let
certFileArray
:
Uint8Array
=
new
Uint8Array
()
;
// The variable context needs to be initialized in MainAbility's onCreate callback function
// test.cer needs to be placed in the rawfile directory
await
g
lobalThis
.
context
.
resourceManager
.
getRawFileContent
(
"
test.cer
"
)
.
then
(
value
=>
{
await
g
etContext
()
.
resourceManager
.
getRawFileContent
(
"
test.cer
"
)
.
then
(
(
value
)
=>
{
certFileArray
=
value
})
.
catch
(
error
=>
{
.
catch
(
(
error
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get row file content. message:
${
error
.
message
}
`
);
return
});
new
Promise
((
resolve
,
reject
)
=>
{
deviceSettings
.
installUserCertificate
(
wantTemp
,
{
inData
:
certFileArray
,
alias
:
"
cert_alias_xts
"
},
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to install user certificate. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
`Succeeded in installing user certificate, result :
${
JSON
.
stringify
(
result
)}
`
);
}
});
deviceSettings
.
installUserCertificate
(
wantTemp
,
{
inData
:
certFileArray
,
alias
:
"
cert_alias_xts
"
},
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
error
(
`Failed to install user certificate. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
}
else
{
console
.
info
(
`Succeeded in installing user certificate, result :
${
JSON
.
stringify
(
result
)}
`
);
}
});
```
...
...
@@ -205,27 +209,31 @@ installUserCertificate(admin: Want, certificate: CertBlob): Promise<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
var
certFileArray
:
Uint8Array
let
certFileArray
:
Uint8Array
=
new
Uint8Array
();
// The variable context needs to be initialized in MainAbility's onCreate callback function
// test.cer needs to be placed in the rawfile directory
await
globalThis
.
context
.
resourceManager
.
getRawFileContent
(
"
test.cer
"
)
.
then
(
data
=>
{
certFileArray
=
data
}).
catch
(
error
=>
{
console
.
log
(
'
getRawFileContent error
'
+
error
)
return
await
getContext
().
resourceManager
.
getRawFileContent
(
"
test.cer
"
)
.
then
((
value
)
=>
{
certFileArray
=
value
})
deviceSettings
.
installUserCertificate
(
wantTemp
,
{
inData
:
certFileArray
,
alias
:
"
cert_alias_xts
"
})
.
catch
((
error
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get row file content. message:
${
error
.
message
}
`
);
return
});
await
deviceSettings
.
installUserCertificate
(
wantTemp
,
{
inData
:
certFileArray
,
alias
:
"
cert_alias_xts
"
})
.
then
((
result
)
=>
{
console
.
info
(
`Succeeded in installing user certificate, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
(
err
=>
{
console
.
error
(
`Failed to install user certificate. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to install user certificate. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
})
```
## CertBlob
...
...
@@ -273,8 +281,9 @@ uninstallUserCertificate(admin: Want, certUri: string, callback: AsyncCallback&l
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -325,15 +334,17 @@ uninstallUserCertificate(admin: Want, certUri: string): Promise<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
aliasStr
=
"
certName
"
deviceSettings
.
uninstallUserCertificate
(
wantTemp
,
aliasStr
).
then
(()
=>
{
console
.
info
(
`Succeeded in uninstalling user certificate`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to uninstall user certificate. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
networkManager
from
'
@ohos.enterprise.networkManager
'
;
```
...
...
@@ -46,8 +46,9 @@ getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string&
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -96,15 +97,17 @@ getAllNetworkInterfaces(admin: Want): Promise<Array<string>>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getAllNetworkInterfaces
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting all network interfaces, result :
${
JSON
.
stringify
(
result
)}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get all network interfaces. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -140,8 +143,9 @@ getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<s
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -191,15 +195,17 @@ getIpAddress(admin: Want, networkInterface: string): Promise<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getIpAddress
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting ip address, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get ip address. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -235,8 +241,9 @@ getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string&
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -286,15 +293,17 @@ getMac(admin: Want, networkInterface: string): Promise\<string>;
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getMac
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting mac, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get mac. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -330,8 +339,9 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string, callback: Asyn
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -381,15 +391,17 @@ isNetworkInterfaceDisabled(admin: Want, networkInterface: string): Promise<bo
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
isNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying network interface is disabled or not, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query network interface is disabled or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -426,8 +438,9 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -478,15 +491,17 @@ setNetworkInterfaceDisabled(admin: Want, networkInterface: string, isDisabled: b
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
setNetworkInterfaceDisabled
(
wantTemp
,
'
eth0
'
,
true
).
then
(()
=>
{
console
.
info
(
`Succeeded in setting network interface disabled`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set network interface disabled. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -522,14 +537,16 @@ setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy, callback: AsyncCall
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
connection
from
'
@ohos.net.connection
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
exclusionStr
=
"
192.168,baidu.com
"
let
exclusionArray
=
exclusionStr
.
split
(
'
,
'
);
let
httpProxy
=
{
let
exclusionStr
:
string
=
"
192.168,baidu.com
"
let
exclusionArray
:
Array
<
string
>
=
exclusionStr
.
split
(
'
,
'
);
let
httpProxy
:
connection
.
HttpProxy
=
{
host
:
"
192.168.xx.xxx
"
,
port
:
8080
,
exclusionList
:
exclusionArray
...
...
@@ -581,14 +598,17 @@ setGlobalProxy(admin: Want, httpProxy: connection.HttpProxy): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
connection
from
'
@ohos.net.connection
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
exclusionStr
=
"
192.168,baidu.com
"
let
exclusionArray
=
exclusionStr
.
split
(
'
,
'
);
let
httpProxy
=
{
let
exclusionStr
:
string
=
"
192.168,baidu.com
"
let
exclusionArray
:
Array
<
string
>
=
exclusionStr
.
split
(
'
,
'
);
let
httpProxy
:
connection
.
HttpProxy
=
{
host
:
"
192.168.xx.xxx
"
,
port
:
8080
,
exclusionList
:
exclusionArray
...
...
@@ -596,7 +616,7 @@ let httpProxy = {
networkManager
.
setGlobalProxy
(
wantTemp
,
httpProxy
).
then
(()
=>
{
console
.
info
(
`Succeeded in setting network global proxy`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set network global proxy. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -631,8 +651,9 @@ getGlobalProxy(admin: Want, callback: AsyncCallback\<connection.HttpProxy>): voi
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -681,15 +702,17 @@ getGlobalProxy(admin: Want): Promise\<connection.HttpProxy>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
getGlobalProxy
(
wantTemp
).
then
(()
=>
{
console
.
info
(
`Succeeded in getting network global proxy`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to get network global proxy. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -725,12 +748,13 @@ addIptablesFilterRule(admin: Want, filterRule: AddFilterRule, callback: AsyncCal
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
filterRule
=
{
let
filterRule
:
networkManager
.
AddFilterRule
=
{
"
ruleNo
"
:
1
,
"
srcAddr
"
:
"
192.168.1.1-192.188.22.66
"
,
"
destAddr
"
:
"
10.1.1.1
"
,
...
...
@@ -788,12 +812,14 @@ addIptablesFilterRule(admin: Want, filterRule: AddFilterRule): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
filterRule
=
{
let
filterRule
:
networkManager
.
AddFilterRule
=
{
"
ruleNo
"
:
1
,
"
srcAddr
"
:
"
192.168.1.1-192.188.22.66
"
,
"
destAddr
"
:
"
10.1.1.1
"
,
...
...
@@ -808,7 +834,7 @@ let filterRule = {
networkManager
.
addIptablesFilterRule
(
wantTemp
,
filterRule
).
then
(()
=>
{
console
.
info
(
`Succeeded in setting iptables filter rule`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set iptables filter rule. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -844,12 +870,13 @@ removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule, callback: As
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
filterRule
=
{
let
filterRule
:
networkManager
.
RemoveFilterRule
=
{
"
srcAddr
"
:
"
192.168.1.1-192.188.22.66
"
,
"
destAddr
"
:
"
10.1.1.1
"
,
"
srcPort
"
:
"
8080
"
,
...
...
@@ -905,12 +932,14 @@ removeIptablesFilterRule(admin: Want, filterRule: RemoveFilterRule): Promise\<vo
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
filterRule
=
{
let
filterRule
:
networkManager
.
RemoveFilterRule
=
{
"
srcAddr
"
:
"
192.168.1.1-192.188.22.66
"
,
"
destAddr
"
:
"
10.1.1.1
"
,
"
srcPort
"
:
"
8080
"
,
...
...
@@ -923,7 +952,7 @@ let filterRule = {
networkManager
.
removeIptablesFilterRule
(
wantTemp
,
filterRule
).
then
(()
=>
{
console
.
info
(
`Succeeded in removing iptables filter rule`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove iptables filter rule. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -958,8 +987,9 @@ listIptablesFilterRules(admin: Want, callback: AsyncCallback\<string>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -1008,15 +1038,17 @@ listIptablesFilterRules(admin: Want): Promise\<string>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
networkManager
.
listIptablesFilterRules
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in getting iptables filter rule, result:
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to remove iptables filter rule. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-restrictions.md
浏览文件 @
e13c2372
...
...
@@ -12,8 +12,8 @@
## 导入模块
```
j
s
import
restrictions
from
'
@ohos.enterprise.restrictions
'
```
t
s
import
restrictions
from
'
@ohos.enterprise.restrictions
'
;
```
## restrictions.setPrinterDisabled
...
...
@@ -47,8 +47,9 @@ setPrinterDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -98,15 +99,17 @@ setPrinterDisabled(admin: Want, disabled: boolean): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
restrictions
.
setPrinterDisabled
(
wantTemp
,
true
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting printer disabled
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set printer disabled. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -141,8 +144,9 @@ isPrinterDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -191,15 +195,17 @@ isPrinterDisabled(admin: Want): Promise\<boolean>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
restrictions
.
isPrinterDisabled
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying is the printing function disabled :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query is the printing function disabled or not. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -235,8 +241,9 @@ setHdcDisabled(admin: Want, disabled: boolean, callback: AsyncCallback\<void>):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -286,15 +293,17 @@ setHdcDisabled(admin: Want, disabled: boolean): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
restrictions
.
setHdcDisabled
(
wantTemp
,
true
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting hdc disabled
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set hdc disabled. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
@@ -329,8 +338,9 @@ isHdcDisabled(admin: Want, callback: AsyncCallback\<boolean>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
...
...
@@ -379,15 +389,17 @@ isHdcDisabled(admin: Want): Promise\<boolean>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
restrictions
.
isHdcDisabled
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in querying is hdc disabled :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query is hdc disabled or not. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
zh-cn/application-dev/reference/apis/js-apis-enterprise-usbManager.md
浏览文件 @
e13c2372
...
...
@@ -12,8 +12,8 @@
## 导入模块
```
j
s
import
usbManager
from
'
@ohos.enterprise.usbManager
'
```
t
s
import
usbManager
from
'
@ohos.enterprise.usbManager
'
;
```
## usbManager.setUsbPolicy
...
...
@@ -47,12 +47,13 @@ setUsbPolicy(admin: Want, usbPolicy: UsbPolicy, callback: AsyncCallback\<void>):
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
policy
=
usbManager
.
UsbPolicy
.
READ_WRITE
let
policy
:
usbManager
.
UsbPolicy
=
usbManager
.
UsbPolicy
.
READ_WRITE
usbManager
.
setUsbPolicy
(
wantTemp
,
policy
,
(
err
)
=>
{
if
(
err
)
{
...
...
@@ -99,16 +100,18 @@ setUsbPolicy(admin: Want, usbPolicy: UsbPolicy): Promise\<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
bundleName
'
,
abilityName
:
'
abilityName
'
,
};
let
policy
=
usbManager
.
UsbPolicy
.
READ_WRITE
let
policy
:
usbManager
.
UsbPolicy
=
usbManager
.
UsbPolicy
.
READ_WRITE
usbManager
.
setUsbPolicy
(
wantTemp
,
policy
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting usb policy
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to set usb policy. Code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
```
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
浏览文件 @
e13c2372
...
...
@@ -12,7 +12,7 @@
## 导入模块
```
j
s
```
t
s
import
wifiManager
from
'
@ohos.enterprise.wifiManager
'
;
```
...
...
@@ -46,8 +46,9 @@ isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -96,15 +97,17 @@ isWifiActive(admin: Want): Promise<boolean>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
wifiManager
.
isWifiActive
(
wantTemp
).
then
((
result
)
=>
{
console
.
info
(
`Succeeded in query is wifi active or not, result :
${
result
}
`
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
error
(
`Failed to query is wifi active or not. Code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
```
...
...
@@ -140,8 +143,9 @@ setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback<voi
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
...
...
@@ -196,12 +200,14 @@ setWifiProfile(admin: Want, profile: WifiProfile): Promise<void>
**示例:**
```
js
let
wantTemp
=
{
```
ts
import
Want
from
'
@ohos.app.ability.Want
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
wantTemp
:
Want
=
{
bundleName
:
'
com.example.myapplication
'
,
abilityName
:
'
EntryAbility
'
,
};
let
profile
:
wifiManager
.
WifiProfile
=
{
let
profile
:
wifiManager
.
WifiProfile
=
{
'
ssid
'
:
'
name
'
,
'
preSharedKey
'
:
'
passwd
'
,
'
securityType
'
:
wifiManager
.
WifiSecurityType
.
WIFI_SEC_TYPE_PSK
...
...
@@ -209,7 +215,7 @@ let profile : wifiManager.WifiProfile = {
wifiManager
.
setWifiProfile
(
wantTemp
,
profile
).
then
(()
=>
{
console
.
info
(
'
Succeeded in setting wifi profile
'
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
:
BusinessError
)
=>
{
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录