RunningMultiInstanceInfo (System API)

The module defines the information of a multi-instance application in the running state. The information can be obtained through getRunningMultiAppInfo of appManager.

NOTE

The initial APIs of this module are supported since API version 14. Newly added APIs will be marked with a superscript to indicate their earliest API version.

The APIs provided by this module are system APIs.

RunningMultiInstanceInfo

System API: This is a system API.

System capability: SystemCapability.Ability.AbilityRuntime.Core

Name Type Read-Only Optional Description
instanceKey string No No Unique instance ID of a multi-instance application.
uid number No No UID of the application.
pids Array<number> No No Process ID set of the application.

Example

import { appManager } from '@kit.AbilityKit';
import { hilog } from '@kit.PerformanceAnalysisKit';
import { BusinessError } from '@kit.BasicServicesKit';

try {
  let bundleName = "ohos.samples.etsclock";
  appManager.getRunningMultiAppInfo(bundleName).then((info: appManager.RunningMultiAppInfo) => {
      hilog.info(0x0000, 'testTag', `getRunningMultiAppInfo success`);
    }).catch((err: BusinessError) => {
      hilog.error(0x0000, 'testTag', `getRunningMultiAppInfo error, code: ${err.code}, msg:${err.message}`);
    })
} catch (err) {
  hilog.error(0x0000, 'testTag', `getRunningMultiAppInfo error, code: ${err.code}, msg:${err.message}`);
}