未验证 提交 0d0c9130 编写于 作者: O openharmony_ci 提交者: Gitee

!19427 【EDM】新增EDM应用开发概述

Merge pull request !19427 from 李兀立/master
......@@ -385,16 +385,19 @@
- 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-configPolicy.md)
- [@ohos.enterprise.accountManager(帐户管理)](js-apis-enterprise-accountManager.md)
- 企业设备管理
- [企业设备管理概述](企业设备管理概述.md)
- [@ohos.enterprise.accountManager (帐户管理)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (企业设备管理)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager(应用管理)](js-apis-enterprise-applicationManager.md)
- [@ohos.enterprise.bundleManager(包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.applicationManager (应用管理)](js-apis-enterprise-applicationManager.md)
- [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (系统时间管理)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (设备控制管理)](js-apis-enterprise-deviceControl.md)
- [@ohos.enterprise.deviceInfo(设备信息管理)](js-apis-enterprise-deviceInfo.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager(网络管理)](js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.wifiManager(WiFi管理)](js-apis-enterprise-wifiManager.md)
- [@ohos.enterprise.deviceInfo (设备信息管理)](js-apis-enterprise-deviceInfo.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager (网络管理)](js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.wifiManager (WiFi管理)](js-apis-enterprise-wifiManager.md)
- 语言基础类库
- [@ohos.buffer (Buffer)](js-apis-buffer.md)
......
# @ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
# @ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)
本模块提供企业管理员应用拓展能力。
本模块提供企业设备管理扩展能力。
企业管理员应用需要存在一个EnterpriseAdminExtensionAbility并重写相关接口,以此具备模块提供的各项能力,比如接收由系统发送的该应用被激活或者去激活的通知。
......
......@@ -1271,3 +1271,242 @@ bundleManager.getDisallowedUninstallBundles(wantTemp, 100).then((data) => {
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
## bundleManager.uninstall
uninstall(admin: Want, bundleName: string, callback: AsyncCallback<void>): void
指定管理员应用卸载当前用户下的指定包接口,且不保留包数据,使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| bundleName | string | 是 | 包名。 |
| 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",
};
bundleManager.uninstall(wantTemp, "bundleName", (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
});
```
## bundleManager.uninstall
uninstall(admin: Want, bundleName: string, userId: number, callback: AsyncCallback<void>): void
指定管理员应用卸载指定用户下(由参数userId指定)的指定包接口,且不保留包数据,使用callback异步回调。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| bundleName | string | 是 | 包名。 |
| 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",
};
bundleManager.uninstall(wantTemp, "bundleName", 100, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
});
```
## bundleManager.uninstall
uninstall(admin: Want, bundleName: string, isKeepData: boolean, callback: AsyncCallback<void>): void
指定管理员应用卸载当前用户下的指定包接口,使用callback异步回调。若isKeepData为false时,表示不保留包数据,若isKeepData为true,则表示保留包数据。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| bundleName | string | 是 | 包名。 |
| isKeepData | boolean | 是 | 是否保留包数据,true表示保留,false表示不保留。 |
| 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",
};
bundleManager.uninstall(wantTemp, "bundleName", true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
});
```
## bundleManager.uninstall
uninstall(admin: Want, bundleName: string, userId: number, isKeepData: boolean, callback: AsyncCallback<void>): void
指定管理员应用卸载指定用户下(由参数userId指定)的指定包接口,使用callback异步回调。若isKeepData为false时,表示不保留包数据,若isKeepData为true,则表示保留包数据。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------- | ---- | ------------------------------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| bundleName | string | 是 | 包名。 |
| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| isKeepData | boolean | 是 | 是否保留包数据,true表示保留,false表示不保留。 |
| 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",
};
bundleManager.uninstall(wantTemp, "bundleName", 100, true, (error) => {
if (error != null) {
console.log("error code:" + error.code + " error message:" + error.message);
} else {
console.log("success.");
}
});
```
## bundleManager.uninstall
uninstall(admin: Want, bundleName: string, userId?: number, isKeepData?: boolean): Promise<void>
指定管理员应用卸载指定用户下的指定包接口,使用promise异步回调。若调用接口时填写参数userId,则表示卸载该指定用户下的包,若未填写参数userId,表示卸载当前用户下的包。若isKeepData为false时,表示不保留包数据,若isKeepData为true,则表示保留包数据;不填写该参数则默认isKeepData为false,即默认不保留包数据。
**需要权限:** ohos.permission.ENTERPRISE_INSTALL_BUNDLE
**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager
**系统API**: 此接口为系统接口。
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ----------------------------------- | ---- | ------- |
| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 |
| bundleName | string | 是 | 包名。 |
| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 |
| isKeepData | boolean | 否 | 是否保留包数据,true表示保留,false表示不保留。 |
**返回值:**
| 类型 | 说明 |
| --------------------- | ------------------------- |
| 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",
};
bundleManager.uninstall(wantTemp, "bundleName", 100, true).then(() => {
console.log("success.");
}).catch(error => {
console.log("error code:" + error.code + " error message:" + error.message);
});
```
\ No newline at end of file
# 企业设备管理(仅对系统应用开放)
## 概述
OpenHarmony通过企业设备管理(Enterprise Device Management)API支持企业应用,该API提供了系统级别的管理功能,用于实现企业对员工设备的管理和配置。如在企业场景下,IT人员需要员工设备进行管理和控制,安装企业应用、设置安全策略、设置企业邮箱、企业网络接入以及远程清除(即恢复出厂默认设置)丢失或者被盗设备上的数据。
## 开发企业管理应用
### 约束与限制
- 仅支持Stage模型
### 环境准备
- DevEco Studio可参考其官网介绍进行[下载](https://developer.harmonyos.com/cn/develop/deveco-studio#download),并进行相关的配置动作。
- ohos-sdk-full可参考OpenHarmony网站进行[下载](https://gitee.com/openharmony/docs/blob/master/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md#%E4%BB%8E%E9%95%9C%E5%83%8F%E7%AB%99%E7%82%B9%E8%8E%B7%E5%8F%96)
### 开发步骤
1. 使用DevEco Studio新建工程、[替换full-sdk](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md)
2.[应用签名文件](../../security/accesstoken-overview.md#应用apl等级说明)中设置应用为系统应用,即app-feature字段为hos_system_app。
3. 创建EnterpriseAdminExtensionAbility,创建过程详情请见[EnterpriseAdminExtensionAbility开发指南](../../application-models/enterprise-extensionAbility.md)
4. 声明接口所需权限。在申请权限前,请保证符合[权限使用的基本原则](../../security/accesstoken-overview.md#权限使用的基本原则)。然后参考[配置文件权限声明指导文档](../../security/accesstoken-guidelines.md#acl方式声明)声明对应权限。
### API参考
> **说明:**
>
> - 若想进行网络管理,WiFi管理等开发,请参考以下内容。
- [@ohos.enterprise.accountManager (帐户管理)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (企业设备管理)](js-apis-enterprise-adminManager.md)
- [@ohos.enterprise.applicationManager (应用管理)](js-apis-enterprise-applicationManager.md)
- [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md)
- [@ohos.enterprise.dateTimeManager (系统时间管理)](js-apis-enterprise-dateTimeManager.md)
- [@ohos.enterprise.deviceControl (设备控制管理)](js-apis-enterprise-deviceControl.md)
- [@ohos.enterprise.deviceInfo (设备信息管理)](js-apis-enterprise-deviceInfo.md)
- [@ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)](js-apis-EnterpriseAdminExtensionAbility.md)
- [@ohos.enterprise.networkManager (网络管理)](js-apis-enterprise-networkManager.md)
- [@ohos.enterprise.wifiManager (WiFi管理)](js-apis-enterprise-wifiManager.md)
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册