• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
2
3The **EnterpriseAdminExtensionAbility** module provides Extension abilities for enterprise administrators.
4
5To 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.
6
7> **NOTE**
8>
9> 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.
10>
11> The APIs of this module can be used only in the stage model.
12
13## Modules to Import
14
15```ts
16import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility'
17```
18
19## EnterpriseAdminExtensionAbility.onAdminEnabled
20
21onAdminEnabled(): void
22
23Called when an enterprise administrator is enabled.
24
25**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
26
27**System API**: This is a system API.
28
29**Example**
30
31```ts
32export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
33  onAdminEnabled() {
34  }
35};
36```
37
38## EnterpriseAdminExtensionAbility.onAdminDisabled
39
40onAdminDisabled(): void
41
42Called when an enterprise administrator is disabled.
43
44**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
45
46**System API**: This is a system API.
47
48**Example**
49
50```ts
51export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
52  onAdminDisabled() {
53  }
54};
55```
56
57## EnterpriseAdminExtensionAbility.onBundleAdded
58
59onBundleAdded(bundleName: string): void
60
61Called when a bundle is added.
62
63**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
64
65**System API**: This is a system API.
66
67**Parameters**
68
69| Parameter  | Type                                 | Mandatory  | Description     |
70| ----- | ----------------------------------- | ---- | ------- |
71| bundleName | string | Yes   | Name of the bundle added.|
72
73**Example**
74
75```ts
76export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
77  onBundleAdded(bundleName: string) {
78    console.log("added bundle name: " + bundleName);
79  }
80};
81```
82
83## EnterpriseAdminExtensionAbility.onBundleRemoved
84
85onBundleRemoved(bundleName: string): void
86
87Called when a bundle is removed.
88
89**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
90
91**System API**: This is a system API.
92
93**Parameters**
94
95| Parameter  | Type                                 | Mandatory  | Description     |
96| ----- | ----------------------------------- | ---- | ------- |
97| bundleName | string | Yes   | Name of the bundle removed.|
98
99**Example**
100
101```ts
102export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
103  onBundleAdded(bundleName: string) {
104    console.log("removed bundle name: " + bundleName);
105  }
106};
107```
108