• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RunningMultiAppInfo (System API)
2
3The RunningMultiAppInfo module defines the information of an application in multi-app mode in the running state.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 12. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8>
9> The APIs provided by this module are system APIs.
10
11## How to Use
12
13The RunningMultiAppInfo struct is obtained from [getRunningMultiAppInfo](js-apis-app-ability-appManager-sys.md#appmanagergetrunningmultiappinfo12) of **appManager**.
14
15## RunningMultiAppInfo
16
17**System API**: This is a system API.
18
19**System capability**: SystemCapability.Ability.AbilityRuntime.Core
20
21| Name                     | Type  | Read-Only | Optional | Description      |
22| ------------------------- | ------ | ---- | ---- | --------- |
23| bundleName | string | No | No | Bundle name of the application.|
24| mode | [MultiAppMode](js-apis-inner-application-multiAppMode-sys.md) | No | No | Multi-app mode.|
25| runningAppClones | Array<[RunningAppClone](js-apis-inner-application-runningAppClone-sys.md)> | No | Yes | Information about application clones with the specific bundle name in the running state.|
26| runningMultiInstances<sup>14+</sup> | Array<[RunningMultiInstanceInfo](js-apis-inner-application-runningMultiInstanceInfo-sys.md)> | No | Yes | Information about a multi-instance application with the specific bundle name in the running state.|
27
28**Example**
29
30```ts
31import { appManager } from '@kit.AbilityKit';
32import { BusinessError } from '@kit.BasicServicesKit';
33
34try {
35  let bundleName = "ohos.samples.etsclock";
36  appManager.getRunningMultiAppInfo(bundleName)
37    .then((info: appManager.RunningMultiAppInfo) => {
38      console.info(`getRunningMultiAppInfo success, data: ${JSON.stringify(info)}`);
39    }).catch((err: BusinessError) => {
40    console.error(`getRunningMultiAppInfo failed, code: ${err.code}, msg:${err.message}`);
41  })
42} catch (err) {
43  let code = (err as BusinessError).code;
44  let msg = (err as BusinessError).message;
45  console.error(`getRunningMultiAppInfo error, code: ${code}, msg:${msg}`);
46}
47```
48