• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ExtensionAbility Overview
2
3
4The ExtensionAbility component is used for specific scenarios such as widget development and input method development.
5
6
7The system defines an [ExtensionAbility type](../reference/apis/js-apis-bundleManager.md#extensionabilitytype) for every specific scenario. You can use (implement and access) only the types that have been defined. All types of ExtensionAbility components are managed by the corresponding system services in a unified manner. For example, the InputMethodExtensionAbility component is managed by the input method management service.
8
9The table below lists the ExtensionAbility types defined in the system.
10
11**NOTE**
12
13- The column **Allow Third-Party Apps to Implement** specifies whether third-party applications can inherit the **ExtensionAbility** parent class and implement their own service logic for a type of ExtensionAbility. The value **Y** means that third-party applications can implement their own service logic for a type of ExtensionAbility, **N** means the opposite.
14- The column **Allow Third-Party Apps to Access** specifies whether third-party applications can access external services provided by a type of ExtensionAbility. The value **Y** means that third-party applications can access external services provided by a certain type of ExtensionAbility, **N** means that they cannot access external services, and **NA** means that no external services are provided.
15
16System applications are not restricted. They can implement all the ExtensionAbility types defined in the system and access external services provided by all the ExtensionAbility types.
17
18| Supported ExtensionAbility Type                | Description| Allow Third-Party Apps to Implement                 | Allow Third-Party Apps to Access                                                |
19| ------------------------ | -------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
20| [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md)                 | ExtensionAbility component of the form type, which provides APIs related to widgets.     | Y | N |
21| [WorkSchedulerExtensionAbility](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md) | ExtensionAbility component of the work_scheduler type, which provides callbacks for Work Scheduler tasks.     | Y | NA |
22| [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md) | ExtensionAbility component of the input_method type, which is used to develop input method applications.     | Y | Y |
23|[AccessibilityExtensionAbility](../reference/apis/js-apis-application-accessibilityExtensionAbility.md) | ExtensionAbility component of the accessibility type, which provides APIs related to the accessibility feature.     | Y | NA |
24|[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) | ExtensionAbility component of the service type, which provides APIs related to background services. To implement transaction processing in the background for a third-party application, use background tasks rather than ServiceExtensionAbility. For details, see [Background Task](../task-management/background-task-overview.md).     | N | Y |
25|[DataShareExtensionAbility](../reference/apis/js-apis-application-dataShareExtensionAbility.md) | ExtensionAbility component of the data_share type, which provides APIs for data sharing.     | N | Y |
26|[StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md) | ExtensionAbility component of the static_subscriber type, which provides APIs for static broadcast.     | N | NA |
27|[WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md) | ExtensionAbility component of the window type, which allows a system application to be embedded in and displayed over another application.     | N | NA |
28| [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md)            | ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.     | N | NA |
29
30
31
32## Accessing ExtensionAbility of the Specified Type
33
34Each type of ExtensionAbility component is started by the corresponding system management service, rather than applications, so that its lifecycle is under system control. The caller of the ExtensionAbility component does not need to care about its lifecycle.
35
36The following uses [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md) as an example. As shown in the figure below, when an application calls the InputMethodExtensionAbility component, the input method management service is called first. The input method management service starts the InputMethodExtensionAbility component, returns the component to the application, and starts to manage its lifecycle.
37
38**Figure 1** Using the InputMethodExtensionAbility component
39
40![ExtensionAbility-start](figures/ExtensionAbility-start.png)
41
42
43## Implementing ExtensionAbility of the Specified Type
44
45The following uses [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md) as an example. The widget framework provides the base class [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md). You can derive this base class to create your own class (for example, **MyFormExtensionAbility**) and implement the callbacks, such as **onCreate()** and **onUpdateForm()**, to provide specific widget features. For details, see [FormExtensionAbility](service-widget-overview.md).
46
47You do not need to care when to add or delete a widget. The lifecycle of the FormExtensionAbility instance and the lifecycle of the ExtensionAbility process where the FormExtensionAbility instance is located are managed by FormManagerService.
48
49![form_extension](figures/form_extension.png)
50
51
52> **NOTE**
53>
54> For an application, all ExtensionAbility components of the same type run in an independent process, whereas the UIAbility, ServiceExtensionAbility, and DataShareExtensionAbility components run in another independent process. For details, see [Process Model (Stage Model)](process-model-stage.md).
55