1# @ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
2
3The **EnterpriseAdminExtensionAbility** module provides extended enterprise device management capabilities.
4
5To have the capabilities provided by this module, for example, to receive a notification when a device administrator application is enabled or disabled, you need to create an **EnterpriseAdminExtensionAbility** instance for the enterprise administrator application and overload related APIs.
6
7> **NOTE**
8>
9> - The initial APIs of this module are supported since API version 12. 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
14## Modules to Import
15
16```ts
17import { EnterpriseAdminExtensionAbility } from '@kit.MDMKit'
18```
19
20## EnterpriseAdminExtensionAbility.onAdminEnabled
21
22onAdminEnabled(): void
23
24Called when a device administrator application is enabled.
25
26**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
27
28
29
30**Example**
31
32```ts
33export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
34  onAdminEnabled() {
35  }
36};
37```
38
39## EnterpriseAdminExtensionAbility.onAdminDisabled
40
41onAdminDisabled(): void
42
43Called when a device administrator application is disabled.
44
45**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
46
47
48
49**Example**
50
51```ts
52export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
53  onAdminDisabled() {
54  }
55};
56```
57
58## EnterpriseAdminExtensionAbility.onBundleAdded
59
60onBundleAdded(bundleName: string): void
61
62Called when a bundle is added.
63
64**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
65
66
67
68**Parameters**
69
70| Name  | Type                                 | Mandatory  | Description     |
71| ----- | ----------------------------------- | ---- | ------- |
72| bundleName | string | Yes   | Name of the bundle added.|
73
74**Example**
75
76```ts
77export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
78  onBundleAdded(bundleName: string) {
79    console.info(`Succeeded in calling onBundleAdded callback, added bundle name : ${bundleName}`);
80  }
81};
82```
83
84## EnterpriseAdminExtensionAbility.onBundleRemoved
85
86onBundleRemoved(bundleName: string): void
87
88Called when a bundle is removed.
89
90**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
91
92
93
94**Parameters**
95
96| Name  | Type                                 | Mandatory  | Description     |
97| ----- | ----------------------------------- | ---- | ------- |
98| bundleName | string | Yes   | Name of the bundle removed.|
99
100**Example**
101
102```ts
103export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
104  onBundleRemoved(bundleName: string) {
105    console.info(`Succeeded in calling onBundleRemoved callback, removed bundle name : ${bundleName}`);
106  }
107};
108```
109
110## EnterpriseAdminExtensionAbility.onAppStart
111
112onAppStart(bundleName: string): void
113
114Called when an application is started.
115
116**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
117
118
119
120**Parameters**
121
122| Name  | Type                                 | Mandatory  | Description     |
123| ----- | ----------------------------------- | ---- | ------- |
124| bundleName | string | Yes   | Bundle name of the application started.|
125
126**Example**
127
128```ts
129export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
130  onAppStart(bundleName: string) {
131    console.info(`Succeeded in calling onAppStart callback, started bundle name : ${bundleName}`);
132  }
133};
134```
135
136## EnterpriseAdminExtensionAbility.onAppStop
137
138onAppStop(bundleName: string): void
139
140Called when an application is stopped.
141
142**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
143
144
145
146**Parameters**
147
148| Name  | Type                                 | Mandatory  | Description     |
149| ----- | ----------------------------------- | ---- | ------- |
150| bundleName | string | Yes   | Bundle name of the application stopped.|
151
152**Example**
153
154```ts
155export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
156  onAppStop(bundleName: string) {
157    console.info(`Succeeded in calling onAppStop callback, stopped bundle name : ${bundleName}`);
158  }
159};
160```
161## EnterpriseAdminExtensionAbility.onSystemUpdate
162
163onSystemUpdate(systemUpdateInfo: systemManager.SystemUpdateInfo): void
164
165Called to report a system update event.
166
167**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
168
169
170
171**Parameters**
172
173| Name          | Type                                                        | Mandatory| Description                |
174| ---------------- | ------------------------------------------------------------ | ---- | -------------------- |
175| systemUpdateInfo | [systemManager.SystemUpdateInfo](js-apis-enterprise-systemManager.md#systemupdateinfo) | Yes  | Information about the version update.|
176
177**Example**
178
179```ts
180import { systemManager } from '@kit.MDMKit';
181export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
182  onSystemUpdate(systemUpdateInfo: systemManager.SystemUpdateInfo) {
183    console.info(`Succeeded in calling onSystemUpdate callback, version name  : ${systemUpdateInfo.versionName}`);
184  }
185};
186```
187
188## EnterpriseAdminExtensionAbility.onStart
189
190onStart(): void
191
192Called when EnterpriseAdminExtensionAbility starts.
193
194**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
195
196
197
198**Example**
199
200```ts
201export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
202  onStart() {
203    console.info(`Succeeded in calling onStart callback.`);
204  }
205};
206```
207