1e41f4b71Sopenharmony_ci# WindowExtensionAbility (for System Applications Only)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci
4e41f4b71Sopenharmony_ci[WindowExtensionAbility](../reference/apis-arkui/js-apis-application-windowExtensionAbility-sys.md) is a type of ExtensionAbility component that allows only a system application to be embedded in and displayed over another application.
5e41f4b71Sopenharmony_ci
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ciThe WindowExtensionAbility component must be used together with the [UIExtensionComponent](../reference/apis-arkui/arkui-ts/ts-container-ui-extension-component-sys.md) to process services of the started application. WindowExtensionAbility is run in connection mode. A system application must use the UIExtensionComponent to start the WindowExtensionAbility component.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ciEach ExtensionAbility has its own context. For WindowExtensionAbility,
10e41f4b71Sopenharmony_cithe context is [WindowExtensionContext](../reference/apis-arkui/js-apis-inner-application-windowExtensionContext-sys.md). In this document, the started WindowExtensionAbility is called the provider, and the UIExtensionComponent that starts the WindowExtensionAbility is called the client.
11e41f4b71Sopenharmony_ci
12e41f4b71Sopenharmony_ci> **NOTE**
13e41f4b71Sopenharmony_ci>
14e41f4b71Sopenharmony_ci> This document involves the use of system APIs. You must use the full SDK for development. <!--Del-->For details, see [Guide to Switching to Full SDK](../faqs/full-sdk-switch-guide.md).<!--DelEnd-->
15e41f4b71Sopenharmony_ci
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## Setting an Embedded UIAbility
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciThe **WindowExtensionAbility** class provides **onConnect()**, **onDisconnect()**, and **onWindowReady()** lifecycle callbacks, which can be overridden.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci- The **onWindowReady()** callback is invoked when a window is created for the UIAbility.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci- The **onConnect()** callback is invoked when the AbilityComponent corresponding to the window connects to the UIAbility.
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ci- The **onDisconnect()** callback is invoked when the AbilityComponent disconnects from the UIAbility.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci
28e41f4b71Sopenharmony_ci**How to Develop**
29e41f4b71Sopenharmony_ci
30e41f4b71Sopenharmony_ciTo implement an embedded application, manually create a WindowExtensionAbility in DevEco Studio as follows:
31e41f4b71Sopenharmony_ci
32e41f4b71Sopenharmony_ci1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **WindowExtAbility**.
33e41f4b71Sopenharmony_ci
34e41f4b71Sopenharmony_ci2. Right-click the **WindowExtAbility** directory, and choose **New > TypeScript File** to create a file named **WindowExtAbility.ts**.
35e41f4b71Sopenharmony_ci
36e41f4b71Sopenharmony_ci3. Open the **WindowExtAbility.ts** file and import the dependency package of **WindowExtensionAbility**. Customize a class that inherits from **WindowExtensionAbility** and implement the **onWindowReady()**, **onConnect()**, and **onDisconnect()** lifecycle callbacks.
37e41f4b71Sopenharmony_ci
38e41f4b71Sopenharmony_ci   ```ts
39e41f4b71Sopenharmony_ci    import { WindowExtensionAbility, window } from '@kit.ArkUI';
40e41f4b71Sopenharmony_ci    import { Want } from '@kit.AbilityKit';
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci    export default class WindowExtAbility extends WindowExtensionAbility {
43e41f4b71Sopenharmony_ci        onWindowReady(window: window.Window) {
44e41f4b71Sopenharmony_ci            window.loadContent('WindowExtAbility/pages/index1').then(() => {
45e41f4b71Sopenharmony_ci                window.getProperties().then((pro) => {
46e41f4b71Sopenharmony_ci                    console.info("WindowExtension " + JSON.stringify(pro));
47e41f4b71Sopenharmony_ci                })
48e41f4b71Sopenharmony_ci                window.show();
49e41f4b71Sopenharmony_ci            })
50e41f4b71Sopenharmony_ci        }
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci        onConnect(want: Want) {
53e41f4b71Sopenharmony_ci            console.info('JSWindowExtension onConnect ' + want.abilityName);
54e41f4b71Sopenharmony_ci        }
55e41f4b71Sopenharmony_ci
56e41f4b71Sopenharmony_ci        onDisconnect(want: Want) {
57e41f4b71Sopenharmony_ci            console.info('JSWindowExtension onDisconnect ' + want.abilityName);
58e41f4b71Sopenharmony_ci        }
59e41f4b71Sopenharmony_ci    }
60e41f4b71Sopenharmony_ci   ```
61e41f4b71Sopenharmony_ci
62e41f4b71Sopenharmony_ci4. Register the WindowExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"window"** and **srcEntry** to the code path of the ExtensionAbility component.
63e41f4b71Sopenharmony_ci
64e41f4b71Sopenharmony_ci   ```json
65e41f4b71Sopenharmony_ci   {
66e41f4b71Sopenharmony_ci     "module": {
67e41f4b71Sopenharmony_ci       "extensionAbilities": [
68e41f4b71Sopenharmony_ci            {
69e41f4b71Sopenharmony_ci                "name": "WindowExtAbility",
70e41f4b71Sopenharmony_ci                "srcEntry": "./ets/WindowExtAbility/WindowExtAbility.ts",
71e41f4b71Sopenharmony_ci                "icon": "$media:icon",
72e41f4b71Sopenharmony_ci                "description": "WindowExtension",
73e41f4b71Sopenharmony_ci                "type": "window",
74e41f4b71Sopenharmony_ci                "exported": true,
75e41f4b71Sopenharmony_ci            }
76e41f4b71Sopenharmony_ci        ],
77e41f4b71Sopenharmony_ci     }
78e41f4b71Sopenharmony_ci   }
79e41f4b71Sopenharmony_ci   ```
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci
82e41f4b71Sopenharmony_ci## Starting an Embedded UIAbility
83e41f4b71Sopenharmony_ci
84e41f4b71Sopenharmony_ciSystem applications can load the created WindowExtensionAbility through the AbilityComponent.
85e41f4b71Sopenharmony_ci
86e41f4b71Sopenharmony_ci**How to Develop**
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci1. To connect to an embedded application, add the AbilityComponent to the corresponding pages in the DevEco Studio project.
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci2. Set **bundleName** and **abilityName** in the AbilityComponent.
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ci3. Set the width and height. The sample code is as follows:
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci```ts
95e41f4b71Sopenharmony_ci@Entry
96e41f4b71Sopenharmony_ci@Component
97e41f4b71Sopenharmony_cistruct Index {
98e41f4b71Sopenharmony_ci  @State message: string = 'Hello World'
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci  build() {
101e41f4b71Sopenharmony_ci    Row() {
102e41f4b71Sopenharmony_ci      Column() {
103e41f4b71Sopenharmony_ci        AbilityComponent({ abilityName: "WindowExtAbility", bundleName: "com.example.WindowExtAbility"})
104e41f4b71Sopenharmony_ci          .width(500)
105e41f4b71Sopenharmony_ci          .height(500)
106e41f4b71Sopenharmony_ci      }
107e41f4b71Sopenharmony_ci      .width('100%')
108e41f4b71Sopenharmony_ci    }
109e41f4b71Sopenharmony_ci    .height('100%')
110e41f4b71Sopenharmony_ci    .backgroundColor(0x64BB5c)
111e41f4b71Sopenharmony_ci  }
112e41f4b71Sopenharmony_ci}
113e41f4b71Sopenharmony_ci```
114e41f4b71Sopenharmony_ci
115