js-apis-EnterpriseAdminExtensionAbility.md 2.9 KB
Newer Older
1
# @ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
W
wusongqing 已提交
2

W
wusongqing 已提交
3 4 5
The **EnterpriseAdminExtensionAbility** module provides Extension abilities for enterprise administrators.

To have the capabilities provided by the module, for example, receiving the application activation or deactivation notification sent by the system, an enterprise administrator application must have an **EnterpriseAdminExtensionAbility** instance and override the APIs in it.
W
wusongqing 已提交
6 7 8 9

> **NOTE**
> 
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
W
wusongqing 已提交
10
> 
W
wusongqing 已提交
11
> The APIs of this module can be used only in the stage model.
W
wusongqing 已提交
12

W
wusongqing 已提交
13 14 15
## Modules to Import

```ts
16
import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility'
W
wusongqing 已提交
17 18
```

W
wusongqing 已提交
19
## EnterpriseAdminExtensionAbility.onAdminEnabled
W
wusongqing 已提交
20 21 22 23 24 25 26

onAdminEnabled(): void

Called when an enterprise administrator is enabled.

**System capability**: SystemCapability.Customization.EnterpriseDeviceManager

27 28
**System API**: This is a system API.

W
wusongqing 已提交
29 30
**Example**

W
wusongqing 已提交
31
```ts
W
wusongqing 已提交
32
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
W
wusongqing 已提交
33 34
  onAdminEnabled() {
  }
W
wusongqing 已提交
35
};
W
wusongqing 已提交
36
```
W
wusongqing 已提交
37

W
wusongqing 已提交
38
## EnterpriseAdminExtensionAbility.onAdminDisabled
W
wusongqing 已提交
39 40 41 42 43 44 45

onAdminDisabled(): void

Called when an enterprise administrator is disabled.

**System capability**: SystemCapability.Customization.EnterpriseDeviceManager

46 47
**System API**: This is a system API.

W
wusongqing 已提交
48 49
**Example**

W
wusongqing 已提交
50
```ts
W
wusongqing 已提交
51
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
W
wusongqing 已提交
52 53
  onAdminDisabled() {
  }
W
wusongqing 已提交
54
};
W
wusongqing 已提交
55
```
G
Gloria 已提交
56 57 58 59 60 61 62 63 64

## EnterpriseAdminExtensionAbility.onBundleAdded

onBundleAdded(bundleName: string): void

Called when a bundle is added.

**System capability**: SystemCapability.Customization.EnterpriseDeviceManager

65 66
**System API**: This is a system API.

G
Gloria 已提交
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90
**Parameters**

| Parameter  | Type                                 | Mandatory  | Description     |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes   | Name of the bundle added.|

**Example**

```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
  onBundleAdded(bundleName: string) {
    console.log("added bundle name: " + bundleName);
  }
};
```

## EnterpriseAdminExtensionAbility.onBundleRemoved

onBundleRemoved(bundleName: string): void

Called when a bundle is removed.

**System capability**: SystemCapability.Customization.EnterpriseDeviceManager

91 92
**System API**: This is a system API.

G
Gloria 已提交
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
**Parameters**

| Parameter  | Type                                 | Mandatory  | Description     |
| ----- | ----------------------------------- | ---- | ------- |
| bundleName | string | Yes   | Name of the bundle removed.|

**Example**

```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
  onBundleAdded(bundleName: string) {
    console.log("removed bundle name: " + bundleName);
  }
};
```