diff --git a/zh-cn/application-dev/reference/apis-ability-kit/errorcode-ability.md b/zh-cn/application-dev/reference/apis-ability-kit/errorcode-ability.md index c3a58740863f04c56b70afb74791285ee9a1a16d..5c7cfd266b0abfe4cc80c57ec2282b8fbe5c1bb8 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/errorcode-ability.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/errorcode-ability.md @@ -913,6 +913,134 @@ An error occurred during the interaction between the ability and window. 检查是否成功创建了AbilityDelegatorRegistry实例。 + +## 16000120 wantList内的元素个数超出4个 + +**错误信息** + +A maximum of four UIAbility instances can be started simultaneously.The current parameter exceeds the maximum number. + +**错误描述** + +最多支持同时启动4个UIAbility,当前传参超过上限。 + +**可能原因** + +wantList内的元素个数超出4个。 + +**处理步骤** + +检查wantList内的元素个数,是否已超过上限。 + +## 16000121 待启动的目标组件类型不是UIAbility + +**错误信息** + +The target component type is not a UIAbility. + +**错误描述** + +待启动的目标组件类型不是UIAbility。 + +**可能原因** + +startUIAbilities只支持启动UIAbility,如果目标组件为非UIAbility,抛出该错误码。 + +**处理步骤** + +检查Want中传入的组件类型,确保其为UIAbility组件。 + +## 16000122 待启动的目标组件被系统管控模块拦截 + +**错误信息** + +The target component is blocked by the system module and does not support startup. + +**错误描述** + +待启动的目标组件被系统管控模块拦截,不支持启动。 + +**可能原因** + +系统管控模块拦截了目标应用的启动。 + +**处理步骤** + +如果无法启动目标UIAbility,可以尝试启动其他UIAbility。 + +## 16000123 不支持隐式启动 + +**错误信息** + +Implicit startup is not supported. + +**错误描述** + +不支持隐式启动。 + +**可能原因** + +wantList参数中存在隐式Want。 + +**处理步骤** + +检查wantList参数,确保不存在隐式Want,若存在则将其修改为显式Want。 + +## 16000124 不支持启动分布式UIAbility + +**错误信息** + +Starting a remote UIAbility is not supported. + +**错误描述** + +不支持启动分布式UIAbility。 + +**可能原因** + +Want中的deviceId不为空且非本机的设备ID。 + +**处理步骤** + +将Want中的deviceId字段设为空,或配置为本机的deviceId。 + +## 16000125 不支持启动插件 + +**错误信息** + +Starting a plugin UIAbility is not supported. + +**错误描述** + +不支持启动插件。 + +**可能原因** + +Want中的parameters指定了启动插件UIAbility。 + +**处理步骤** + +检查Want中的parameters参数,不要将ohos.params.pluginAbility设置为true。 + +## 16000126 不支持启动DLP文件 + +**错误信息** + +Starting DLP files is not supported. + +**错误描述** + +不支持启动DLP文件。 + +**可能原因** + +Want中传入了DLP文件。 + +**处理步骤** + +检查Want是否携带了DLP文件。 + + ## 16000151 无效wantAgent对象 **错误信息** diff --git a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-serviceExtensionContext-sys.md b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-serviceExtensionContext-sys.md index d589d2dc2f510241c4467117f7e4825983274787..a565cd0dba0da73ba0d44d7d3294d84275b66b83 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-serviceExtensionContext-sys.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-serviceExtensionContext-sys.md @@ -2775,4 +2775,94 @@ export default class ServiceExtension extends ServiceExtensionAbility { } } } +``` + +## ServiceExtensionContext.startUIAbilities20+ + +startUIAbilities(wantList: Array): Promise\ + +同时启动多个UIAbility。使用Promise异步回调。 + +开发者可以传入多个UIAbility对应的Want信息,这些UIAbility可以指向一个或多个应用。当所有的UIAbility都能启动成功时,系统会通过多个窗口同时展示这些UIAbility。根据窗口的处理,不同设备上可能会有不同的展示效果(包括窗口形态、数量和排版布局)。 + +> **说明:** +> +> 该接口仅在phone和tablet设备上生效。 +> +> 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)。 + +**系统接口**:此接口为系统接口。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ------ | ------ | +| wantList | Array\<[Want](js-apis-app-ability-want.md)> | 是 | 需要被同时拉起的多个UIAbility的启动参数列表,最多支持传入4个Want。启动参数Want不支持隐式启动、跨用户启动、分布式、免安装和按需加载,不指明分身的情况下默认启动主应用。| + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| Promise<void> | Promise对象,无返回结果。| + +**错误码**: + +以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。 + +| 错误码ID | 错误信息 | +| ------ | ------ | +| 201 | The application does not have permission to call the interface. | +| 202 | Not system application. | +| 801 | Capability not supported. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Failed to start the invisible ability. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | +| 16000073 | The app clone index is invalid. | +| 16000076 | The app instance key is invalid. | +| 16000080 | Creating a new instance is not supported. | +| 16000120 | A maximum of four UIAbility instances can be started simultaneously. The current parameter exceeds the maximum number.| +| 16000121 | The target component type is not a UIAbility. | +| 16000122 | The target component is blocked by the system module and does not support startup. | +| 16000123 | Implicit startup is not supported. | +| 16000124 | Starting a remote UIAbility is not supported. | +| 16000125 | Starting a plugin UIAbility is not supported. | +| 16000126 | Starting DLP files is not supported. | + +**示例**: + +```ts +import { ServiceExtensionAbility, Want } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +export default class EntryServiceExtAbility extends ServiceExtensionAbility { + OnCreate() { + let want1: Want = { + bundleName: 'cpm.example.myapplication1', + abilityName: 'EntryAbility' + }; + let want2: Want = { + bundleName: 'cpm.example.myapplication2', + abilityName: 'EntryAbility' + }; + let wantList: Array = [want1, want2]; + try { + this.context.startUIAbilities(wantList).then(() => { + console.info(`TestTag:: start succeeded.`); + }).catch((error: BusinessError) => { + console.info(`TestTag:: startUIAbilities failed: ${JSON.stringify(error)}`); + }); + } catch (paramError) { + // 处理入参错误异常 + console.error(`error.code: ${paramError.code}, error.message: ${paramError.message}`); + } + } +} ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiExtensionContext-sys.md b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiExtensionContext-sys.md index 06fbab3725f6bb5bacbf0e08747b77c2408a4298..95d8f407a51f7e2fa175748eccf33bb8b2fba791 100644 --- a/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiExtensionContext-sys.md +++ b/zh-cn/application-dev/reference/apis-ability-kit/js-apis-inner-application-uiExtensionContext-sys.md @@ -305,3 +305,93 @@ export default class UIExtAbility extends UIExtensionAbility { } } ``` + +### startUIAbilities20+ + +startUIAbilities(wantList: Array): Promise\ + +同时启动多个UIAbility。使用Promise异步回调。 + +开发者可以传入多个UIAbility对应的Want信息,这些UIAbility可以指向一个或多个应用。当所有的UIAbility都能启动成功时,系统会通过多个窗口同时展示这些UIAbility。根据窗口的处理,不同设备上可能会有不同的展示效果(包括窗口形态、数量和排版布局)。 + +> **说明:** +> +> 该接口仅在phone和tablet设备上生效。 +> +> 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)。 + +**系统接口**:此接口为系统接口。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ------ | ------ | +| wantList | Array\<[Want](js-apis-app-ability-want.md)> | 是 | 需要被同时拉起的多个UIAbility的启动参数列表,最多支持传入4个Want。启动参数Want不支持隐式启动、跨用户启动、分布式、免安装和按需加载,不指明分身的情况下默认启动主应用。| + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| Promise<void> | Promise对象,无返回结果。| + +**错误码**: + +以下错误码详细介绍请参考[通用错误码](../errorcode-universal.md)和[元能力子系统错误码](errorcode-ability.md)。 + +| 错误码ID | 错误信息 | +| ------ | ------ | +| 201 | The application does not have permission to call the interface. | +| 202 | Not system application. | +| 801 | Capability not supported. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Failed to start the invisible ability. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | +| 16000073 | The app clone index is invalid. | +| 16000076 | The app instance key is invalid. | +| 16000080 | Creating a new instance is not supported. | +| 16000120 | A maximum of four UIAbility instances can be started simultaneously. The current parameter exceeds the maximum number.| +| 16000121 | The target component type is not a UIAbility. | +| 16000122 | The target component is blocked by the system module and does not support startup. | +| 16000123 | Implicit startup is not supported. | +| 16000124 | Starting a remote UIAbility is not supported. | +| 16000125 | Starting a plugin UIAbility is not supported. | +| 16000126 | Starting DLP files is not supported. | + +**示例**: + +```ts +import { UIExtensionAbility, Want } from '@kit.AbilityKit'; +import { BusinessError } from '@kit.BasicServicesKit'; + +export default class EntryUIExtAbility extends UIExtensionAbility { + OnForeground() { + let want1: Want = { + bundleName: 'cpm.example.myapplication1', + abilityName: 'EntryAbility' + }; + let want2: Want = { + bundleName: 'cpm.example.myapplication2', + abilityName: 'EntryAbility' + }; + let wantList: Array = [want1, want2]; + try { + this.context.startUIAbilities(wantList).then(() => { + console.info(`TestTag:: start succeeded.`); + }).catch((error: BusinessError) => { + console.info(`TestTag:: startUIAbilities failed: ${JSON.stringify(error)}`); + }); + } catch (paramError) { + // 处理入参错误异常 + console.error(`error.code: ${paramError.code}, error.message: ${paramError.message}`); + } + } +} +``` \ No newline at end of file