• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 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 a device administrator application 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 a device administrator application 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| Name  | 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.info(`Succeeded in calling onBundleAdded callback, 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| Name  | 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  onBundleRemoved(bundleName: string) {
104    console.info(`Succeeded in calling onBundleRemoved callback, removed bundle name : ${bundleName}`);
105  }
106};
107```
108
109## EnterpriseAdminExtensionAbility.onAppStart<sup>10+</sup>
110
111onAppStart(bundleName: string): void
112
113Called when an application is started.
114
115**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
116
117**System API**: This is a system API.
118
119**Parameters**
120
121| Name  | Type                                 | Mandatory  | Description     |
122| ----- | ----------------------------------- | ---- | ------- |
123| bundleName | string | Yes   | Bundle name of the application started.|
124
125**Example**
126
127```ts
128export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
129  onAppStart(bundleName: string) {
130    console.info(`Succeeded in calling onAppStart callback, started bundle name : ${bundleName}`);
131  }
132};
133```
134
135## EnterpriseAdminExtensionAbility.onAppStop<sup>10+</sup>
136
137onAppStop(bundleName: string): void
138
139Called when an application is stopped.
140
141**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
142
143**System API**: This is a system API.
144
145**Parameters**
146
147| Name  | Type                                 | Mandatory  | Description     |
148| ----- | ----------------------------------- | ---- | ------- |
149| bundleName | string | Yes   | Bundle name of the application stopped.|
150
151**Example**
152
153```ts
154export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
155  onAppStop(bundleName: string) {
156    console.info(`Succeeded in calling onAppStop callback, stopped bundle name : ${bundleName}`);
157  }
158};
159```
160