• Home
Name Date Size #Lines LOC

..--

AppScope/06-May-2025-3734

entry/06-May-2025-2,0531,737

hvigor/06-May-2025-2422

screenshots/device/06-May-2025-

.gitignoreD06-May-202596 77

README.mdD06-May-20251.6 KiB3819

README_zh.mdD06-May-20254 KiB7856

build-profile.json5D06-May-20251 KiB4241

hvigorfile.jsD06-May-2025168 21

hvigorwD06-May-20252.1 KiB6428

hvigorw.batD06-May-20252 KiB7356

oh-package.json5D06-May-2025822 2725

ohosTest.mdD06-May-2025779 1410

README.md

1# Window Extension Ability
2
3### Introduction
4
5This sample simulates the **Setting** app, where you can touch the menu bar to go to the details page.
6
7In this sample, the [Window Extension Ability](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkui/js-apis-application-windowExtensionAbility-sys.md) is used to set abilities, and [AbilityComponent](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis-arkui/arkui-ts/ts-container-ability-component-sys.md) is used to load abilities.
8
9### Usage
10
111. In portrait mode, touch the **Setting** menu bar on the left. The details page is displayed.
12
132. In landscape mode, touch the **Setting** menu bar on the left. The details page is displayed on the right.
14
15### Preview
16
17![](screenshots/device/en/index.png) ![](screenshots/device/en/wlan.png)
18![](screenshots/device/en/bluetooth.png) ![](screenshots/device/en/mobileData.png)
19
20### Required Permissions
21
22N/A
23
24### Dependency
25
26N/A
27
28### Constraints
29
301. This sample can only be run on standard-system devices that use the Rockchip RK3568 chip.
31
322. This sample demonstrates the stage model, which supports only the SDK of API version 9 (SDK version: 3.2.6.3 Beta2).
33
343. DevEco Studio 3.1 Canary1 (Build Version: 3.1.0.100) must be used.
35
364. **WindowExtensionAbility** and **AbilityComponent** are system APIs and require the use of the Full SDK. To use the Full SDK, you must manually obtain it from the mirror and switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](https://docs.openharmony.cn/pages/v3.2/en/application-dev/quick-start/full-sdk-switch-guide.md/).
37
38

README_zh.md

1# 窗口扩展应用(仅对系统应用开放)
2
3### 介绍
4
5本示例仿设置应用,实现点击设置菜单栏,跳转或加载详情页面。
6
7本示例通过 [窗口扩展能力](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/js-apis-application-windowExtensionAbility-sys.md) 设置不同Ability,使用 [AbilityComponent](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-ability-component-sys.md) 组件加载各个Ability。
8
9### 效果预览
10
11|主页| WLAN页面                              | 蓝牙页面                                     | 移动数据页面                                    |
12|--------------------------------|-------------------------------------|------------------------------------------|-------------------------------------------|
13|![](screenshots/device/zh/index.png) | ![](screenshots/device/zh/wlan.png) | ![](screenshots/device/zh/bluetooth.png) | ![](screenshots/device/zh/mobileData.png) |
14
15使用说明:
16
171.竖屏模式下点击左侧设置菜单栏,跳转详情页面。
18
192.横屏模式下点击左侧设置菜单栏,右侧显示详情页面。
20
21### 工程目录
22```
23entry/src/main/ets/
24|---Application
25|   |---MyAbilityStage.ts
26|---feature
27|   |---Logger.ts                           // 日志工具
28|   |---Rpc.ts                              // 进程通信
29|---MainAbility
30|   |---BluetoothExtAbility.ts
31|   |---MainAbility.ts
32|   |---MobileDataExtAbility.ts
33|   |---WlanExtAbility.ts
34|---mock
35|   |---InfoData.ts                         // 数据类型
36|---pages
37|   |---common
38|   |   |---Common.ets                      // 全局通用组件
39|   |---Index.ets                           // 首页
40|   |---Bluetooth.ets                       // 蓝牙
41|   |---MobileData.ets                      // 移动数据
42|   |---Wlan.ets                            // Wlan
43```
44### 具体实现
45
46* 本示例通过窗口扩展能力设置不同Ability,使用AbilityComponent组件加载各个Ability,matchMediaSync方法设置媒体查询的查询条件,RemoteObject方法实现远程对象。
47* 源码链接:[WlanExtAbility.ts](entry/src/main/ets/MainAbility/WlanExtAbility.ts),[BluetoothExtAbility.ts](entry/src/main/ets/MainAbility/BluetoothExtAbility.ts),[MobileDataExtAbility.ts](entry/src/main/ets/MainAbility/MobileDataExtAbility.ts),[Rpc.ts](entry/src/main/ets/feature/Rpc.ts)
48* 接口参考:[@ohos.application.WindowExtensionAbility](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/js-apis-application-windowExtensionAbility-sys.md),[AbilityComponent](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/arkui-ts/ts-container-ability-component-sys.md),[@ohos.rpc](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-ipc-kit/js-apis-rpc.md),[@ohos.mediaquery](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-arkui/js-apis-mediaquery.md)
49
50### 相关权限
51
52不涉及。
53
54### 依赖
55
56不涉及。
57
58### 约束与限制
59
601.本示例仅支持标准系统上运行,支持设备:支持RK3568。
61
622.本示例已适配API version 9版本SDK,版本号:3.2.11.9。
63
643.本示例需要使用DevEco Studio 3.1 Beta2 (Build Version: 3.1.0.400, built on April 7, 2023)及以上版本才可编译运行。
65
664.本示例使用的WindowExtensionAbility、AbilityComponent均为系统接口,需要使用Full SDK手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/faqs/full-sdk-switch-guide.md)67
68### 下载
69
70如需单独下载本工程,执行如下命令:
71```
72git init
73git config core.sparsecheckout true
74echo code/SystemFeature/WindowManageMent/WindowExtAbility/ > .git/info/sparse-checkout
75git remote add origin https://gitee.com/openharmony/applications_app_samples.git
76git pull origin master
77
78```