| Name | Date | Size | #Lines | LOC | ||
|---|---|---|---|---|---|---|
| .. | - | - | ||||
| AppScope/ | 12-May-2024 | - | 35 | 32 | ||
| entry/ | 12-May-2024 | - | 534 | 483 | ||
| hvigor/ | 12-May-2024 | - | 24 | 22 | ||
| screenshots/zh/ | 12-May-2024 | - | ||||
| .gitignore | D | 12-May-2024 | 142 | 12 | 12 | |
| README_zh.md | D | 12-May-2024 | 3.8 KiB | 76 | 53 | |
| build-profile.json5 | D | 12-May-2024 | 1.1 KiB | 42 | 41 | |
| hvigorfile.ts | D | 12-May-2024 | 768 | 17 | 1 | |
| hvigorw | D | 12-May-2024 | 1.4 KiB | 49 | 28 | |
| hvigorw.bat | D | 12-May-2024 | 1.5 KiB | 65 | 47 | |
| oh-package.json5 | D | 12-May-2024 | 873 | 28 | 26 |
README_zh.md
1# 意图执行 2 3### 介绍 4 5本示例使用[@ohos.app.ability.InsightIntentExecutor](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-ability-kit/js-apis-app-ability-insightIntentExecutor.md)、[@ohos.app.ability.insightIntent](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis-ability-kit/js-apis-app-ability-insightIntent.md)等接口,展示了意图绑定到UIAbility前台执行,主要包括构造意图配置文件、响应绑定到UIAbility前台执行的意图调用等。 6 7### 效果预览: 8 9| 主页(参照系统应用[IntentDriver](../../../SystemFeature/InsightIntent/IntentDriver)) | 意图绑定到UIAbility前台执行迁移页面 | 意图绑定到UIAbility前台执行结果 | 10| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | 11| <img alt="home" height="640" src="screenshots/zh/home.png" width="360"/> | <img alt="UIAbility" height="640" src="screenshots/zh/executeInUIAbility2.png" width="360"/> | <img alt="UIAbility" height="640" src="screenshots/zh/executeInUIAbility.png" width="360"/> | 12 13使用说明 14 151.启动系统应用[IntentDriver](../../../SystemFeature/InsightIntent/IntentDriver)应用后,主页面上显示两个按钮:意图绑定到UIAbility前台、意图绑定到ServiceExtension; 16 172.点击按钮“意图绑定到UIAbility前台”,触发本应用的意图执行,并加载新的页面,返回意图调用结果通过promptAction.showToast显示在IntentDriver应用; 18 19### 工程目录 20 21``` 22entry/src/main/ 23├─ets 24│ ├─entryability 25│ │ └─EntryAbility.ets // UIAbility,意图绑定到该UIAbility前台执行 26│ ├─intents 27│ │ └─PlayMusicIntentExecutorImpl.ets // 通过意图调用执行基类对接端侧意图框架,实现响应意图调用的业务逻辑 28│ ├─pages 29│ │ ├─Index.ets // 主页面 30│ │ └─IntentPage.ets // 意图绑定到该UIAbility前台执行时加载的页面 31│ └─util 32│ └─Logger.ets // 日志工具 33└─resources 34 └─base 35 └─profile 36 └─insight_intent.json // 意图配置文件 37``` 38 39### 具体实现 40 41* 实现意图调用业务逻辑的功能接口封装在PlayMusicIntentExecutorImpl,源码参考:[PlayMusicIntentExecutorImpl.ets](entry/src/main/ets/intents/PlayMusicIntentExecutorImpl.ets) 42 * 意图绑定到UIAbility前台运行的业务逻辑: 43 实现意图调用执行基类InsightIntentExecutor的onExecuteInUIAbilityForegroundMode()回调函数; 44* 在意图配置文件[insight_intent.json](entry/src/main/resources/base/profile/insight_intent.json)中配置应用支持的意图API列表 45 * 配置内容包括: 46 意图API名称、意图API所属的垂域、意图API版本号、代码相对路径入口、执行模式等; 47* 页面[IntentPage.ets](entry/src/main/ets/pages/IntentPage.ets)是绑定到UIAbility前台运行的意图拉起的页面 48 49### 相关权限 50 51不涉及。 52 53### 依赖 54 55本应用的运行依赖系统应用[IntentDriver](../../../SystemFeature/InsightIntent/IntentDriver)。 56 57### 约束与限制 58 591.本示例仅支持标准系统上运行,支持设备:RK3568; 60 612.本示例为Stage模型,支持API11版本SDK,版本号:4.1.3.1; 62 633.本示例需要使用DevEco Studio 3.1.1 Release (Build Version: 3.1.0.501, built on June 20, 2023)才可编译运行; 64 65### 下载 66 67如需单独下载本工程,执行如下命令: 68 69``` 70git init 71git config core.sparsecheckout true 72echo code/BasicFeature/InsightIntent/IntentExecutor/ > .git/info/sparse-checkout 73git remote add origin https://gitee.com/openharmony/applications_app_samples.git 74git pull origin master 75``` 76