Authorizes the administrator rights to an application through the specified device administrator application. This API uses an asynchronous callback to return the result.
| bundleName | string | Yes| Bundle name of the application to be authorized with the administrator rights.|
| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.|
**Error codes**
For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md).
Authorizes the administrator rights to an application through the specified device administrator application. This API uses a promise to return the result.
@@ -48,18 +48,17 @@ The administrator ability component is invalid.
...
@@ -48,18 +48,17 @@ The administrator ability component is invalid.
**Description**
**Description**
This error code is reported when the administrator ability component specified in the input parameters is invalid.
This error code is reported when the specified device administrator ability component is invalid.
**Possible Causes**
**Possible Causes**
The specified administrator ability component is invalid due to any of the following:
1. The administrator ability component does not exist when the device administrator application is enabled.
1. The administrator ability component does not exist when the application is enabled as a device administrator application.
2. The administrator ability component is not a valid enterprise administrator ability component.
2. The administrator ability component is not valid in an enterprise setting.
**Solution**
**Solution**
1.Make sure the name of the device administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
1.Check that the name of the administrator ability component is included in the application bundle when the application is enabled as a device administrator application.
2.Make sure the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device administrator framework.
2.Check that the administrator ability component inherits the **EnterpriseAdminExtensionAbility** component defined by the enterprise device management framework.
## 9200004 Failed to Enable the Device Administrator Application
## 9200004 Failed to Enable the Device Administrator Application
...
@@ -69,20 +68,19 @@ Failed to activate the administrator application of the device.
...
@@ -69,20 +68,19 @@ Failed to activate the administrator application of the device.
**Description**
**Description**
This error code is reported when the application fails to be enabled as a device administrator application.
This error code is reported when an application fails to be enabled as a device administrator application.
**Possible Causes**
**Possible Causes**
1. Multiple applications are enabled as the super device administrator application.
1. Multiple applications are enabled as super device administrators (SDAs).
2. The application has been enabled as a device administrator application with a different administrator type.
2. The application has been enabled as a device administrator, and the device administrator type has changed.
3. Multiple device administrator ability components are enabled for the same application.
3. Multiple device administrator ability components of the same application are enabled.
**Solution**
**Solution**
1.Make sure only one application is enabled as SDA.
1.Check that only one super device administrator application exists.
2. Check whether the application has been enabled as a device administrator and whether the device administrator type changes when it is enabled again. If this is the case, disable the device administrator and enable it again.
2. Check whether the current application has been enabled as a device administrator with a different device administrator type. If yes, disable the device administrator application and try again.
3. Check whether any ability component in the application has been enabled as the device administrator. Only one ability component in an application can be enabled as the device administrator.
3. Check whether a device administrator ability component has been enabled for the application. Only one device administrator ability component can be enabled for an application.
## 9200005 Failed to Disable the Device Administrator Application
## 9200005 Failed to Disable the Device Administrator Application
...
@@ -92,19 +90,18 @@ Failed to deactivate the administrator application of the device.
...
@@ -92,19 +90,18 @@ Failed to deactivate the administrator application of the device.
**Description**
**Description**
This error code is reported when the application to disable has not been enabled as a device administrator application or the attempt to disable the device administrator application is made by a device administrator application.
This error code is reported when the operation for disabling a device administrator application fails.
**Possible Causes**
**Possible Causes**
1. The application to be disabled is not an enabled device administrator application.
1. The application to disable has not been enabled as a device administrator application.
2. The caller cannot disable other device administrator applications.
2. The attempt to disable the device administrator application is made by a device administrator application.
**Solution**
**Solution**
1. Check whether the target application has been enabled as a device administrator application.
1. Check that the target device administrator application has been enabled.
2. Check whether the specified ability component in the target application has been enabled as a device administrator.
2. Check that the specified device administrator ability component of the target device administrator application has been enabled.
3. Check whether the attempt to disable the device administrator application is made by a device administrator application.
3. Check that the device administrator application to be disabled is the caller itself.
## 9200006 Invalid User ID
## 9200006 Invalid User ID
...
@@ -114,20 +111,19 @@ The specified user ID is invalid.
...
@@ -114,20 +111,19 @@ The specified user ID is invalid.
**Description**
**Description**
This error code is reported when the application calls an API to set the user policy but the specified user ID does not exist or the specified user ID is different from the caller user ID.
This error code is reported when the specified user ID does not exist or the specified user ID is different from the caller's user ID.
**Possible Causes**
**Possible Causes**
1. The user ID specified for setting a user policy does not exist.
1. The user ID used to set a user policy does not exist.
2. The specified user ID is different from the caller's user ID when the application is not a super device administrator application.
2. The specified user ID is different from the caller user ID, and the application is not a super device administrator (SDA) application.
**Solution**
**Solution**
1.Make sure the user ID specified in the called API is valid.
1.Check that the specified user ID is valid.
2. Check whether the caller user ID and the specified user ID are the same. In non-SDA mode, policies cannot be set across users.
2. Check that caller's user ID is the same as the specified user ID. If the application is not a super device administrator application, policies cannot be set across users.
## 9200007 System Service Error
## 9200007 System Ability Error
**Error Message**
**Error Message**
...
@@ -135,21 +131,20 @@ The system ability work abnormally.
...
@@ -135,21 +131,20 @@ The system ability work abnormally.
**Description**
**Description**
This error code is reported when the enterprise device management service is not working correctly.
This error code is reported when the enterprise device management ability is not working properly.
**Possible Causes**
**Possible Causes**
1. The EnterpriseAdminAbility is not started.
1. The enterprise device management service is not started properly.
2. The RPC object for enterprise device management cannot be obtained.
2. The RPC object for enterprise device management cannot be obtained.
3. Other services on which the enterprise device management service depends are not started properly or the RPC object cannot be obtained for them.
3. Other abilities, on which the EnterpriseAdminAbility depends, are not started, or the RPC object cannot be obtained.
4. A system exception occurs during the running of the enterprise device management service.
4. A system exception occurs during the running of EnterpriseAdminAbility.
**Solution**
**Solution**
Try again later or restart the device.
Try again later or restart the device.
## 9200008 Invalid System Event Subscription
## 9200008 Invalid System Subscription Event
**Error Message**
**Error Message**
...
@@ -165,4 +160,45 @@ The enterprise device management module does not support subscription to the spe
...
@@ -165,4 +160,45 @@ The enterprise device management module does not support subscription to the spe
**Solution**
**Solution**
Make sure the event to subscribe to is a valid management event supported by the enterprise device management module.
Check that the specified event is valid and supported by the enterprise device management module.
## 9200009 Failed to Grant Permissions to the Application
**Error Message**
Authorize permission to the application failed.
**Description**
This error code is reported when the super device administrator application fails to grant administrator rights to other applications.
**Possible Causes**
The target application is not installed by the administrator.
**Solution**
Check that the target application has been installed by the administrator.
## 9201002 Failed to Install the Application
**Error Message**
The application installation failed.
**Description**
This error code is reported when a device administrator application fails to install an enterprise application.
**Possible Causes**
1. The application installation path is empty or invalid, or does not exist.
2. The operation attempts to install multiple apps with different bundle names.
3. The application to be installed already exists when the installation parameter flag is 0.
4. The user ID is invalid.
**Solution**
1. Check that the application installation path is valid.
2. Check that all the installation parameters are valid.