Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3eff930f
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
3eff930f
编写于
6月 01, 2023
作者:
O
openharmony_ci
提交者:
Gitee
6月 01, 2023
浏览文件
操作
浏览文件
下载
差异文件
!18654 【EDM】新增应用卸载黑名单接口文档
Merge pull request !18654 from 方昀/master
上级
4a5fc28a
3fbccee6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
434 addition
and
12 deletion
+434
-12
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
...v/reference/apis/js-apis-enterprise-applicationManager.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
...on-dev/reference/apis/js-apis-enterprise-bundleManager.md
+430
-8
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-enterprise-applicationManager.md
浏览文件 @
3eff930f
...
@@ -17,7 +17,7 @@ import applicationManager from '@ohos.enterprise.applicationManager';
...
@@ -17,7 +17,7 @@ import applicationManager from '@ohos.enterprise.applicationManager';
addDisallowedRunningBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
addDisallowedRunningBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用添加应用运行黑名单接口,使用callback形式返回是否添加成功。添加至黑名单的应用不允许在
管理员
用户下运行,否则允许运行。
指定设备管理员应用添加应用运行黑名单接口,使用callback形式返回是否添加成功。添加至黑名单的应用不允许在
当前
用户下运行,否则允许运行。
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
...
@@ -302,7 +302,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(()
...
@@ -302,7 +302,7 @@ applicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(()
getDisallowedRunningBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
getDisallowedRunningBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
指定管理员应用获取
管理员
用户下的应用运行黑名单接口,使用callback形式返回获取应用运行黑名单。
指定管理员应用获取
当前
用户下的应用运行黑名单接口,使用callback形式返回获取应用运行黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
...
@@ -389,7 +389,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
...
@@ -389,7 +389,7 @@ applicationManager.getDisallowedRunningBundles(wantTemp, 100, (error) => {
getDisallowedRunningBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
getDisallowedRunningBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
如果调用接口时传入参数userId,指定管理员应用获取指定用户下应用运行黑名单接口,如果调用接口时没有传入参数userId,指定管理员应用获取当前用户下应用运行黑名单接口,使用promise形式返回获取
应用运行黑名单。
指定管理员应用获取指定用户或当前用户下应用运行黑名单接口,使用promise形式返回获取应用运行黑名单。如果调用接口时传入参数userId,表示获取指定用户下应用运行黑名单,如果调用接口没有传入参数userId,表示获取当前用户下
应用运行黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY
...
@@ -408,7 +408,7 @@ getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<s
...
@@ -408,7 +408,7 @@ getDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<s
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ------------------------- |
| --------------------- | ------------------------- |
| Promise
<
Array
<
string
>>
| Promise对象,返回
管理员
用户下的应用运行黑名单。 |
| Promise
<
Array
<
string
>>
| Promise对象,返回
当前
用户下的应用运行黑名单。 |
**错误码**
:
**错误码**
:
...
...
zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md
浏览文件 @
3eff930f
...
@@ -17,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager';
...
@@ -17,7 +17,7 @@ import bundleManager from '@ohos.enterprise.bundleManager';
addAllowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
addAllowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用添加包安装白名单接口,添加至白名单的应用允许在
管理员
用户下安装,否则不允许安装,使用callback形式返回是否添加成功。
指定设备管理员应用添加包安装白名单接口,添加至白名单的应用允许在
当前
用户下安装,否则不允许安装,使用callback形式返回是否添加成功。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -301,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
...
@@ -301,7 +301,7 @@ bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => {
getAllowedInstallBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
getAllowedInstallBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
指定管理员应用获取
管理员
用户下的包安装白名单接口,使用callback形式返回获取包安装白名单。
指定管理员应用获取
当前
用户下的包安装白名单接口,使用callback形式返回获取包安装白名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -388,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
...
@@ -388,7 +388,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => {
getAllowedInstallBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
getAllowedInstallBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
如果调用接口时传入参数userId,指定管理员应用获取指定用户下包安装白名单接口,如果调用接口时没有传入参数userId,指定管理员应用获取当前用户下包安装白名单接口,使用promise形式返回获取
包安装白名单。
指定管理员应用获取指定用户或当前用户下包安装白名单接口,使用promise形式返回获取包安装白名单。如果调用接口时传入参数userId,表示获取指定用户下包安装白名单,如果调用接口没有传入参数userId,表示获取当前用户下
包安装白名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -407,7 +407,7 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<stri
...
@@ -407,7 +407,7 @@ getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<stri
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ------------------------- |
| --------------------- | ------------------------- |
| Promise
<
Array
<
string
>>
| Promise对象,返回
管理员
用户下的包安装白名单。 |
| Promise
<
Array
<
string
>>
| Promise对象,返回
当前
用户下的包安装白名单。 |
**错误码**
:
**错误码**
:
...
@@ -436,7 +436,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
...
@@ -436,7 +436,7 @@ bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => {
addDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
addDisallowedInstallBundles(admin: Want, appIds: Array
\<
string>, callback: AsyncCallback
<
void
>
): void;
指定设备管理员应用添加包安装黑名单接口,添加至黑名单的应用不允许安装,使用callback形式返回是否添加成功。
指定设备管理员应用添加包安装黑名单接口,添加至黑名单的应用不允许
在当前用户下
安装,使用callback形式返回是否添加成功。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -720,7 +720,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
...
@@ -720,7 +720,7 @@ bundleManager.removeDisallowedInstallBundles(wantTemp, appIds, 100).then(() => {
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
getDisallowedInstallBundles(admin: Want, callback: AsyncCallback
<
Array
<
string
>>
): void;
指定管理员应用获取
管理员
用户下的包安装黑名单接口,使用callback形式返回获取包安装黑名单。
指定管理员应用获取
当前
用户下的包安装黑名单接口,使用callback形式返回获取包安装黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -807,7 +807,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
...
@@ -807,7 +807,7 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100, (error) => {
getDisallowedInstallBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
getDisallowedInstallBundles(admin: Want, userId?: number): Promise
<
Array
<
string
>>
;
如果调用接口时传入参数userId,指定管理员应用获取指定用户下包安装黑名单接口。如果调用接口时没有传入参数userId,指定管理员应用获取当前用户下包安装黑名单接口,使用promise形式返回获取
包安装黑名单。
指定管理员应用获取指定用户或当前用户下包安装黑名单接口,使用promise形式返回获取包安装黑名单。如果调用接口时传入参数userId,表示获取指定用户下包安装黑名单,如果调用接口没有传入参数userId,表示获取当前用户下
包安装黑名单。
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**需要权限:**
ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
...
@@ -826,7 +826,7 @@ getDisallowedInstallBundles(admin: Want, userId?: number): Promise<Array<s
...
@@ -826,7 +826,7 @@ getDisallowedInstallBundles(admin: Want, userId?: number): Promise<Array<s
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ------------------------- |
| --------------------- | ------------------------- |
| Promise
<
Array
<
string
>>
| Promise对象,返回
管理员
用户下的包安装白名单。 |
| Promise
<
Array
<
string
>>
| Promise对象,返回
当前
用户下的包安装白名单。 |
**错误码**
:
**错误码**
:
...
@@ -849,3 +849,425 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
...
@@ -849,3 +849,425 @@ bundleManager.getDisallowedInstallBundles(wantTemp, 100).then(() => {
}).
catch
(
error
=>
{
}).
catch
(
error
=>
{
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
console
.
log
(
"
error code:
"
+
error
.
code
+
"
error message:
"
+
error
.
message
);
});
});
##
bundleManager
.
addDisallowedUninstallBundles
addDisallowedUninstallBundles
(
admin
:
Want
,
appIds
:
Array
\
<
string
>
,
callback
:
AsyncCallback
&
lt
;
void
&
gt
;):
void
指定设备管理员应用添加包卸载黑名单接口
,
添加至黑名单的应用不允许在当前用户下卸载
,
使用callback形式返回是否添加成功
。
**
需要权限
:
**
ohos
.
permission
.
ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**
系统能力
:
**
SystemCapability
.
Customization
.
EnterpriseDeviceManager
**
系统API
**
:
此接口为系统接口
。
**
参数
:
**
|
参数名
|
类型
|
必填
|
说明
|
|
--------
|
----------------------------------------
|
----
|
-------------------------------
|
|
admin
|
[
Want
](
js
-
apis
-
app
-
ability
-
want
.
md
)
|
是
|
设备管理员应用
。
|
|
appIds
|
Array
&
lt
;
string
&
gt
;
|
是
|
应用ID数组
。
|
|
callback
|
AsyncCallback
&
lt
;
void
&
gt
;
|
是
|
回调函数
。
当接口调用成功
,
err为null
,
否则为错误对象
。
|
**
错误码
**
:
以下的错误码的详细介绍请参见
[
企业设备管理错误码
](..
/
errorcodes
/
errorcode
-
enterpriseDeviceManager
.
md
)
|
错误码ID
|
错误信息
|
|
-------
|
----------------------------------------------------------------------------
|
|
9200001
|
the
application
is
not
an
administrator
of
the
device
.
|
|
9200002
|
the
administrator
application
does
not
have
permission
to
manage
the
device
.
|
**
示例
:
**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback<void>): void
指定设备管理员应用添加包卸载黑名单接口,添加至黑名单的应用不允许在指定用户(通过userId指定)下卸载,使用callback形式返回是否添加成功。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| appIds | Array<string> | 是 | 应用ID数组。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback<void> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.addDisallowedUninstallBundles
addDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise<void>
指定设备管理员应用添加包卸载黑名单接口。如果调用接口时传入了可选参数userId,则添加至黑名单的应用不允许在指定用户下卸载;如果调用接口时没有传入参数userId,则添加至黑名单的应用不允许在当前用户下卸载,使用promise形式返回是否添加成功。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| appIds | Array<string> | 是 | 应用ID数组。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用添加包卸载黑名单失败时会抛出错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.addDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback<void>): void
指定设备管理员应用移除包卸载黑名单接口,在黑名单存在的情况下,在包卸载黑名单中的应用不允许在当前用户下卸载,使用callback形式返回移除结果。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| appIds | Array<string> | 是 | 应用ID数组。 |
| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback<void>): void
指定设备管理员应用移除包卸载黑名单接口,在黑名单存在的情况下,在包卸载黑名单中的应用不允许在指定用户(通过userId指定)下卸载,使用callback形式返回移除结果。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| appIds | Array<string> | 是 | 应用ID数组。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
}
});
```
## bundleManager.removeDisallowedUninstallBundles
removeDisallowedUninstallBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise<void>
指定设备管理员应用移除包卸载黑名单接口。在黑名单存在的情况下,如果调用接口时传入参数userId,则在包卸载黑名单中的应用不允许在指定用户下卸载;如果调用接口时没有传入参数userId,则在包卸载黑名单中的应用不允许在当前用户下卸载,使用promise形式返回移除结果。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| appIds | Array\<string> | 是 | 应用ID数组。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用移除包卸载黑名单失败时会抛出错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
let appIds = ["com.example.myapplication"];
bundleManager.removeDisallowedUninstallBundles(wantTemp, appIds, 100).then(() => {
console.log("success");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, callback: AsyncCallback<Array<string>>): void
指定管理员应用获取当前用户下的包卸载黑名单接口,使用callback形式返回获取包卸载黑名单。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId: number, callback: AsyncCallback<Array<string>>): void
指定管理员应用获取指定用户(通过userId指定)下的包卸载黑名单接口,使用callback形式返回获取包卸载黑名单。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100, (error, data) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success: " + data);
}
});
```
## bundleManager.getDisallowedUninstallBundles
getDisallowedUninstallBundles(admin: Want, userId?: number): Promise<Array<string>>
指定管理员应用获取指定用户或当前用户下包卸载黑名单接口,使用promise形式返回获取包卸载黑名单。如果调用接口时传入参数userId,表示获取指定用户下包卸载黑名单,如果调用接口没有传入参数userId,表示获取当前用户下包卸载黑名单。
**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| Promise<Array<string>> | Promise对象,返回当前用户下的包卸载白名单。 |
**错误码**:
以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md)
| 错误码ID | 错误信息 |
| ------- | ---------------------------------------------------------------------------- |
| 9200001 | the application is not an administrator of the device. |
| 9200002 | the administrator application does not have permission to manage the device. |
**示例:**
```
js
let wantTemp = {
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
};
bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((data) => {
console.log("success: " + data);
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录