RunningMultiAppInfo (System API)
The RunningMultiAppInfo module defines the information of an application in multi-app mode in the running state.
NOTE
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.
The APIs provided by this module are system APIs.
How to Use
The RunningMultiAppInfo struct is obtained from getRunningMultiAppInfo of appManager.
RunningMultiAppInfo
System API: This is a system API.
System capability: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Read-Only | Optional | Description |
|---|---|---|---|---|
| bundleName | string | No | No | Bundle name of the application. |
| mode | MultiAppMode | No | No | Multi-app mode. |
| runningAppClones | Array<RunningAppClone> | No | Yes | Information about application clones with the specific bundle name in the running state. |
| runningMultiInstances14+ | Array<RunningMultiInstanceInfo> | No | Yes | Information about a multi-instance application with the specific bundle name in the running state. |
Example
import { appManager } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
try {
let bundleName = "ohos.samples.etsclock";
appManager.getRunningMultiAppInfo(bundleName)
.then((info: appManager.RunningMultiAppInfo) => {
console.info(`getRunningMultiAppInfo success, data: ${JSON.stringify(info)}`);
}).catch((err: BusinessError) => {
console.error(`getRunningMultiAppInfo failed, code: ${err.code}, msg:${err.message}`);
})
} catch (err) {
let code = (err as BusinessError).code;
let msg = (err as BusinessError).message;
console.error(`getRunningMultiAppInfo error, code: ${code}, msg:${msg}`);
}