1e41f4b71Sopenharmony_ci# @ohos.enterprise.applicationManager (Application Management) (System API) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **applicationManager** module provides application management capabilities, including adding, removing, and obtaining the applications that are forbidden to run. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8e41f4b71Sopenharmony_ci> 9e41f4b71Sopenharmony_ci> - The APIs of this module can be used only in the stage model. 10e41f4b71Sopenharmony_ci> 11e41f4b71Sopenharmony_ci> - The APIs of this module can be called only by a [device administrator application](../../mdm/mdm-kit-guide.md#introduction) that is [enabled](js-apis-enterprise-adminManager-sys.md#adminmanagerenableadmin). 12e41f4b71Sopenharmony_ci> 13e41f4b71Sopenharmony_ci> - This topic describes only the system APIs provided by the module. For details about its public APIs, see [@ohos.enterprise.applicationManager](js-apis-enterprise-applicationManager.md). 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## Modules to Import 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci```ts 18e41f4b71Sopenharmony_ciimport { applicationManager } from '@kit.MDMKit'; 19e41f4b71Sopenharmony_ci``` 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci## applicationManager.addDisallowedRunningBundles 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ciaddDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback<void>): void 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ciAdds the applications that are not allowed to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result. 26e41f4b71Sopenharmony_ci 27e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 30e41f4b71Sopenharmony_ci 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ci 33e41f4b71Sopenharmony_ci**Parameters** 34e41f4b71Sopenharmony_ci 35e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 36e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- | 37e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 38e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to add. | 39e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 40e41f4b71Sopenharmony_ci 41e41f4b71Sopenharmony_ci**Error codes** 42e41f4b71Sopenharmony_ci 43e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 44e41f4b71Sopenharmony_ci 45e41f4b71Sopenharmony_ci| ID| Error Message | 46e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 47e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 48e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 49e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 50e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 51e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 52e41f4b71Sopenharmony_ci 53e41f4b71Sopenharmony_ci 54e41f4b71Sopenharmony_ci**Example** 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci```ts 57e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 58e41f4b71Sopenharmony_cilet wantTemp: Want = { 59e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 60e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 61e41f4b71Sopenharmony_ci}; 62e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 63e41f4b71Sopenharmony_ci 64e41f4b71Sopenharmony_ciapplicationManager.addDisallowedRunningBundles(wantTemp, appIds, (err) => { 65e41f4b71Sopenharmony_ci if (err) { 66e41f4b71Sopenharmony_ci console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 67e41f4b71Sopenharmony_ci return; 68e41f4b71Sopenharmony_ci } 69e41f4b71Sopenharmony_ci console.info('Succeeded in adding disallowed running bundles'); 70e41f4b71Sopenharmony_ci}); 71e41f4b71Sopenharmony_ci``` 72e41f4b71Sopenharmony_ci 73e41f4b71Sopenharmony_ci## applicationManager.addDisallowedRunningBundles 74e41f4b71Sopenharmony_ci 75e41f4b71Sopenharmony_ciaddDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback<void>): void 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ciAdds the applications that are not allowed to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result. 78e41f4b71Sopenharmony_ci 79e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 80e41f4b71Sopenharmony_ci 81e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci 85e41f4b71Sopenharmony_ci**Parameters** 86e41f4b71Sopenharmony_ci 87e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 88e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 89e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 90e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to add. | 91e41f4b71Sopenharmony_ci| userId | number | Yes | User ID, which must be greater than or equal to 0.| 92e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci**Error codes** 95e41f4b71Sopenharmony_ci 96e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci| ID| Error Message | 99e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 100e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 101e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 102e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 103e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 104e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_ci**Example** 107e41f4b71Sopenharmony_ci 108e41f4b71Sopenharmony_ci```ts 109e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 110e41f4b71Sopenharmony_cilet wantTemp: Want = { 111e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 112e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 113e41f4b71Sopenharmony_ci}; 114e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ciapplicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100, (err) => { 117e41f4b71Sopenharmony_ci if (err) { 118e41f4b71Sopenharmony_ci console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 119e41f4b71Sopenharmony_ci return; 120e41f4b71Sopenharmony_ci } 121e41f4b71Sopenharmony_ci console.info('Succeeded in adding disallowed running bundles'); 122e41f4b71Sopenharmony_ci}); 123e41f4b71Sopenharmony_ci``` 124e41f4b71Sopenharmony_ci 125e41f4b71Sopenharmony_ci## applicationManager.addDisallowedRunningBundles 126e41f4b71Sopenharmony_ci 127e41f4b71Sopenharmony_ciaddDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise<void> 128e41f4b71Sopenharmony_ci 129e41f4b71Sopenharmony_ciAdds the applications that are not allowed to run by the current or specified user through the specified device administrator application. This API uses a promise to return the result. 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 132e41f4b71Sopenharmony_ci 133e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 134e41f4b71Sopenharmony_ci 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci**Parameters** 138e41f4b71Sopenharmony_ci 139e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 140e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 141e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 142e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to add. | 143e41f4b71Sopenharmony_ci| userId | number | No | User ID, which must be greater than or equal to 0.<br>- If **userId** is passed in, the applications cannot be run by the specified user.<br>- If **userId** is not passed in, the applications cannot be run by the current user.| 144e41f4b71Sopenharmony_ci 145e41f4b71Sopenharmony_ci**Return value** 146e41f4b71Sopenharmony_ci 147e41f4b71Sopenharmony_ci| Type | Description | 148e41f4b71Sopenharmony_ci| --------------------- | ------------------------- | 149e41f4b71Sopenharmony_ci| Promise<void> | Promise that returns no value. If the operation fails, an error object will be thrown. | 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_ci**Error codes** 152e41f4b71Sopenharmony_ci 153e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci| ID| Error Message | 156e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 157e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 158e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 159e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 160e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 161e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci**Example** 164e41f4b71Sopenharmony_ci 165e41f4b71Sopenharmony_ci```ts 166e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 167e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 168e41f4b71Sopenharmony_cilet wantTemp: Want = { 169e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 170e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 171e41f4b71Sopenharmony_ci}; 172e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ciapplicationManager.addDisallowedRunningBundles(wantTemp, appIds, 100).then(() => { 175e41f4b71Sopenharmony_ci console.info('Succeeded in adding disallowed running bundles'); 176e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 177e41f4b71Sopenharmony_ci console.error(`Failed to add disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 178e41f4b71Sopenharmony_ci}); 179e41f4b71Sopenharmony_ci``` 180e41f4b71Sopenharmony_ci 181e41f4b71Sopenharmony_ci## applicationManager.removeDisallowedRunningBundles 182e41f4b71Sopenharmony_ci 183e41f4b71Sopenharmony_ciremoveDisallowedRunningBundles(admin: Want, appIds: Array\<string>, callback: AsyncCallback<void>): void 184e41f4b71Sopenharmony_ci 185e41f4b71Sopenharmony_ciRemoves the applications that are not allowed to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result. 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 190e41f4b71Sopenharmony_ci 191e41f4b71Sopenharmony_ci 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_ci**Parameters** 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 196e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- | 197e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 198e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to remove. | 199e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 200e41f4b71Sopenharmony_ci 201e41f4b71Sopenharmony_ci**Error codes** 202e41f4b71Sopenharmony_ci 203e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 204e41f4b71Sopenharmony_ci 205e41f4b71Sopenharmony_ci| ID| Error Message | 206e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 207e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 208e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 209e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 210e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 211e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 212e41f4b71Sopenharmony_ci 213e41f4b71Sopenharmony_ci**Example** 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_ci```ts 216e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 217e41f4b71Sopenharmony_cilet wantTemp: Want = { 218e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 219e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 220e41f4b71Sopenharmony_ci}; 221e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ciapplicationManager.removeDisallowedRunningBundles(wantTemp, appIds, (err) => { 224e41f4b71Sopenharmony_ci if (err) { 225e41f4b71Sopenharmony_ci console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 226e41f4b71Sopenharmony_ci return; 227e41f4b71Sopenharmony_ci } 228e41f4b71Sopenharmony_ci console.info('Succeeded in removing disallowed running bundles'); 229e41f4b71Sopenharmony_ci}); 230e41f4b71Sopenharmony_ci``` 231e41f4b71Sopenharmony_ci 232e41f4b71Sopenharmony_ci## applicationManager.removeDisallowedRunningBundles 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ciremoveDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId: number, callback: AsyncCallback<void>): void 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ciRemoves the applications that are not allowed to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result. 237e41f4b71Sopenharmony_ci 238e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 239e41f4b71Sopenharmony_ci 240e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 241e41f4b71Sopenharmony_ci 242e41f4b71Sopenharmony_ci 243e41f4b71Sopenharmony_ci 244e41f4b71Sopenharmony_ci**Parameters** 245e41f4b71Sopenharmony_ci 246e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 247e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 248e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 249e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to remove. | 250e41f4b71Sopenharmony_ci| userId | number | Yes | User ID, which must be greater than or equal to 0.| 251e41f4b71Sopenharmony_ci| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object.| 252e41f4b71Sopenharmony_ci 253e41f4b71Sopenharmony_ci**Error codes** 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ci| ID| Error Message | 258e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 259e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 260e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 261e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 262e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 263e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 264e41f4b71Sopenharmony_ci 265e41f4b71Sopenharmony_ci**Example** 266e41f4b71Sopenharmony_ci 267e41f4b71Sopenharmony_ci```ts 268e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 269e41f4b71Sopenharmony_cilet wantTemp: Want = { 270e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 271e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 272e41f4b71Sopenharmony_ci}; 273e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 274e41f4b71Sopenharmony_ci 275e41f4b71Sopenharmony_ciapplicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100, (err) => { 276e41f4b71Sopenharmony_ci if (err) { 277e41f4b71Sopenharmony_ci console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 278e41f4b71Sopenharmony_ci return; 279e41f4b71Sopenharmony_ci } 280e41f4b71Sopenharmony_ci console.info('Succeeded in removing disallowed running bundles'); 281e41f4b71Sopenharmony_ci}); 282e41f4b71Sopenharmony_ci``` 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_ci## applicationManager.removeDisallowedRunningBundles 285e41f4b71Sopenharmony_ci 286e41f4b71Sopenharmony_ciremoveDisallowedRunningBundles(admin: Want, appIds: Array\<string>, userId?: number): Promise<void> 287e41f4b71Sopenharmony_ci 288e41f4b71Sopenharmony_ciRemoves the applications that are not allowed to run by the current or specified user through the specified device administrator application. This API uses a promise to return the result. 289e41f4b71Sopenharmony_ci 290e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 291e41f4b71Sopenharmony_ci 292e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 293e41f4b71Sopenharmony_ci 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci 296e41f4b71Sopenharmony_ci**Parameters** 297e41f4b71Sopenharmony_ci 298e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 299e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 300e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 301e41f4b71Sopenharmony_ci| appIds | Array<string> | Yes | IDs of the applications to remove. | 302e41f4b71Sopenharmony_ci| userId | number | No | User ID, which must be greater than or equal to 0.<br>- If **userId** is passed in, the applications cannot be run by the specified user.<br>- If **userId** is not passed in, the applications cannot be run by the current user.| 303e41f4b71Sopenharmony_ci 304e41f4b71Sopenharmony_ci**Return value** 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ci| Type | Description | 307e41f4b71Sopenharmony_ci| --------------------- | ------------------------- | 308e41f4b71Sopenharmony_ci| Promise<void> | Promise that returns no value. If the operation fails, an error object will be thrown. | 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ci**Error codes** 311e41f4b71Sopenharmony_ci 312e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 313e41f4b71Sopenharmony_ci 314e41f4b71Sopenharmony_ci| ID| Error Message | 315e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 316e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 317e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 318e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 319e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 320e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ci**Example** 323e41f4b71Sopenharmony_ci 324e41f4b71Sopenharmony_ci```ts 325e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 326e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 327e41f4b71Sopenharmony_cilet wantTemp: Want = { 328e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 329e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 330e41f4b71Sopenharmony_ci}; 331e41f4b71Sopenharmony_cilet appIds: Array<string> = ['com.example.myapplication']; 332e41f4b71Sopenharmony_ci 333e41f4b71Sopenharmony_ciapplicationManager.removeDisallowedRunningBundles(wantTemp, appIds, 100).then(() => { 334e41f4b71Sopenharmony_ci console.info('Succeeded in removing disallowed running bundles'); 335e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 336e41f4b71Sopenharmony_ci console.error(`Failed to remove disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 337e41f4b71Sopenharmony_ci}); 338e41f4b71Sopenharmony_ci``` 339e41f4b71Sopenharmony_ci 340e41f4b71Sopenharmony_ci## applicationManager.getDisallowedRunningBundles 341e41f4b71Sopenharmony_ci 342e41f4b71Sopenharmony_cigetDisallowedRunningBundles(admin: Want, callback: AsyncCallback<Array<string>>): void 343e41f4b71Sopenharmony_ci 344e41f4b71Sopenharmony_ciObtains the applications that are not allowed to run by the current user through the specified device administrator application. This API uses an asynchronous callback to return the result. 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_ci 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ci**Parameters** 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 355e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- | 356e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 357e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | 358e41f4b71Sopenharmony_ci 359e41f4b71Sopenharmony_ci**Error codes** 360e41f4b71Sopenharmony_ci 361e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 362e41f4b71Sopenharmony_ci 363e41f4b71Sopenharmony_ci| ID| Error Message | 364e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 365e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 366e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 367e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 368e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 369e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 370e41f4b71Sopenharmony_ci 371e41f4b71Sopenharmony_ci**Example** 372e41f4b71Sopenharmony_ci 373e41f4b71Sopenharmony_ci```ts 374e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 375e41f4b71Sopenharmony_cilet wantTemp: Want = { 376e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 377e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 378e41f4b71Sopenharmony_ci}; 379e41f4b71Sopenharmony_ci 380e41f4b71Sopenharmony_ciapplicationManager.getDisallowedRunningBundles(wantTemp, (err, result) => { 381e41f4b71Sopenharmony_ci if (err) { 382e41f4b71Sopenharmony_ci console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 383e41f4b71Sopenharmony_ci return; 384e41f4b71Sopenharmony_ci } 385e41f4b71Sopenharmony_ci console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`); 386e41f4b71Sopenharmony_ci}); 387e41f4b71Sopenharmony_ci``` 388e41f4b71Sopenharmony_ci 389e41f4b71Sopenharmony_ci## applicationManager.getDisallowedRunningBundles 390e41f4b71Sopenharmony_ci 391e41f4b71Sopenharmony_cigetDisallowedRunningBundles(admin: Want, userId: number, callback: AsyncCallback<Array<string>>): void 392e41f4b71Sopenharmony_ci 393e41f4b71Sopenharmony_ciObtains the applications that are not allowed to run by the specified user through the specified device administrator application. This API uses an asynchronous callback to return the result. 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 398e41f4b71Sopenharmony_ci 399e41f4b71Sopenharmony_ci 400e41f4b71Sopenharmony_ci 401e41f4b71Sopenharmony_ci**Parameters** 402e41f4b71Sopenharmony_ci 403e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 404e41f4b71Sopenharmony_ci| -------- | ---------------------------------------- | ---- | ------------------------------- | 405e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application. | 406e41f4b71Sopenharmony_ci| userId | number | Yes | User ID, which must be greater than or equal to 0.| 407e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci**Error codes** 410e41f4b71Sopenharmony_ci 411e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 412e41f4b71Sopenharmony_ci 413e41f4b71Sopenharmony_ci| ID| Error Message | 414e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 415e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 416e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 417e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 418e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 419e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 420e41f4b71Sopenharmony_ci 421e41f4b71Sopenharmony_ci**Example** 422e41f4b71Sopenharmony_ci 423e41f4b71Sopenharmony_ci```ts 424e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 425e41f4b71Sopenharmony_cilet wantTemp: Want = { 426e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 427e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 428e41f4b71Sopenharmony_ci}; 429e41f4b71Sopenharmony_ci 430e41f4b71Sopenharmony_ciapplicationManager.getDisallowedRunningBundles(wantTemp, 100, (err, result) => { 431e41f4b71Sopenharmony_ci if (err) { 432e41f4b71Sopenharmony_ci console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 433e41f4b71Sopenharmony_ci return; 434e41f4b71Sopenharmony_ci } 435e41f4b71Sopenharmony_ci console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`); 436e41f4b71Sopenharmony_ci}); 437e41f4b71Sopenharmony_ci``` 438e41f4b71Sopenharmony_ci 439e41f4b71Sopenharmony_ci## applicationManager.getDisallowedRunningBundles 440e41f4b71Sopenharmony_ci 441e41f4b71Sopenharmony_cigetDisallowedRunningBundles(admin: Want, userId?: number): Promise<Array<string>> 442e41f4b71Sopenharmony_ci 443e41f4b71Sopenharmony_ciObtains the applications that are not allowed to run by the current or specified user through the specified device administrator application. This API uses a promise to return the result. 444e41f4b71Sopenharmony_ci 445e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY 446e41f4b71Sopenharmony_ci 447e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Customization.EnterpriseDeviceManager 448e41f4b71Sopenharmony_ci 449e41f4b71Sopenharmony_ci 450e41f4b71Sopenharmony_ci 451e41f4b71Sopenharmony_ci**Parameters** 452e41f4b71Sopenharmony_ci 453e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 454e41f4b71Sopenharmony_ci| ----- | ----------------------------------- | ---- | ------- | 455e41f4b71Sopenharmony_ci| admin | [Want](../apis-ability-kit/js-apis-app-ability-want.md) | Yes | Device administrator application.| 456e41f4b71Sopenharmony_ci| userId | number | No | User ID, which must be greater than or equal to 0.<br>- If **userId** is passed in, the applications cannot be run by the specified user.<br>- If **userId** is not passed in, the applications cannot be run by the current user.| 457e41f4b71Sopenharmony_ci 458e41f4b71Sopenharmony_ci**Return value** 459e41f4b71Sopenharmony_ci 460e41f4b71Sopenharmony_ci| Type | Description | 461e41f4b71Sopenharmony_ci| --------------------- | ------------------------- | 462e41f4b71Sopenharmony_ci| Promise<Array<string>> | Promise used to return the application blocklist of the current user.| 463e41f4b71Sopenharmony_ci 464e41f4b71Sopenharmony_ci**Error codes** 465e41f4b71Sopenharmony_ci 466e41f4b71Sopenharmony_ciFor details about the error codes, see [Enterprise Device Management Error Codes](errorcode-enterpriseDeviceManager.md) and [Universal Error Codes](../errorcode-universal.md). 467e41f4b71Sopenharmony_ci 468e41f4b71Sopenharmony_ci| ID| Error Message | 469e41f4b71Sopenharmony_ci| ------- | ---------------------------------------------------------------------------- | 470e41f4b71Sopenharmony_ci| 9200001 | The application is not an administrator application of the device. | 471e41f4b71Sopenharmony_ci| 9200002 | The administrator application does not have permission to manage the device. | 472e41f4b71Sopenharmony_ci| 201 | Permission verification failed. The application does not have the permission required to call the API. | 473e41f4b71Sopenharmony_ci| 202 | Permission verification failed. A non-system application calls a system API. | 474e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 475e41f4b71Sopenharmony_ci 476e41f4b71Sopenharmony_ci**Example** 477e41f4b71Sopenharmony_ci 478e41f4b71Sopenharmony_ci```ts 479e41f4b71Sopenharmony_ciimport { Want } from '@kit.AbilityKit'; 480e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit'; 481e41f4b71Sopenharmony_cilet wantTemp: Want = { 482e41f4b71Sopenharmony_ci bundleName: 'com.example.myapplication', 483e41f4b71Sopenharmony_ci abilityName: 'EntryAbility', 484e41f4b71Sopenharmony_ci}; 485e41f4b71Sopenharmony_ci 486e41f4b71Sopenharmony_ciapplicationManager.getDisallowedRunningBundles(wantTemp, 100).then((result) => { 487e41f4b71Sopenharmony_ci console.info(`Succeeded in getting disallowed running bundles, result : ${JSON.stringify(result)}`); 488e41f4b71Sopenharmony_ci}).catch((err: BusinessError) => { 489e41f4b71Sopenharmony_ci console.error(`Failed to get disallowed running bundles. Code is ${err.code}, message is ${err.message}`); 490e41f4b71Sopenharmony_ci}); 491e41f4b71Sopenharmony_ci``` 492