• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RunningMultiInstanceInfo (系统接口)
2
3<!--Kit: Ability Kit-->
4<!--Subsystem: Ability-->
5<!--Owner: @wendel; @Luobniz21-->
6<!--Designer: @wendel-->
7<!--Tester: @lixueqing513-->
8<!--Adviser: @huipeizi-->
9
10定义多实例应用在运行态的结构信息,通过appManager的[getRunningMultiAppInfo](js-apis-app-ability-appManager-sys.md#appmanagergetrunningmultiappinfo12)来获取。
11
12> **说明:**
13>
14> 本模块首批接口从API version 14 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
15> 本模块接口为系统接口。
16
17## RunningMultiInstanceInfo
18
19**系统接口**:此接口为系统接口。
20
21**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
22
23| 名称                      | 类型   | 只读 | 可选  | 说明       |
24| ------------------------- | ------ | ---- | ---- | --------- |
25| instanceKey | string | 否 | 否  | 多实例应用的唯一实例标识。 |
26| uid | number | 否 | 否  | 表示应用程序的UID。 |
27| pids | Array\<number> | 否 | 否  | 应用的进程ID集合。 |
28
29**示例:**
30
31```ts
32import { appManager } from '@kit.AbilityKit';
33import { hilog } from '@kit.PerformanceAnalysisKit';
34import { BusinessError } from '@kit.BasicServicesKit';
35
36try {
37  let bundleName = "ohos.samples.etsclock";
38  appManager.getRunningMultiAppInfo(bundleName).then((info: appManager.RunningMultiAppInfo) => {
39      hilog.info(0x0000, 'testTag', `getRunningMultiAppInfo success`);
40    }).catch((err: BusinessError) => {
41      hilog.error(0x0000, 'testTag', `getRunningMultiAppInfo error, code: ${err.code}, msg:${err.message}`);
42    })
43} catch (err) {
44  hilog.error(0x0000, 'testTag', `getRunningMultiAppInfo error, code: ${err.code}, msg:${err.message}`);
45}
46```
47