• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ProcessInformation
2<!--Kit: Ability Kit-->
3<!--Subsystem: Ability-->
4<!--Owner: @SKY2001-->
5<!--Designer: @yzkp-->
6<!--Tester: @lixueqing513-->
7<!--Adviser: @huipeizi-->
8
9The ProcessInformation module defines the running information of a process.
10
11> **NOTE**
12>
13> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
14
15## Modules to Import
16
17```ts
18import { appManager } from '@kit.AbilityKit';
19```
20
21## Properties
22
23**System capability**: SystemCapability.Ability.AbilityRuntime.Core
24
25| Name| Type| Read-Only| Optional| Description|
26| -------- | -------- | -------- | -------- | -------- |
27| pid | number | No| No| Process ID.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
28| uid | number | No| No| User ID.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
29| processName | string | No| No| Process name.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
30| bundleNames | Array&lt;string&gt; | No| No| Names of all running bundles in the process.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
31| state<sup>10+</sup> | [appManager.ProcessState](js-apis-app-ability-appManager.md#processstate10)| No| No| Running status of the process.<br>**Atomic service API**: This API can be used in atomic services since API version 11.|
32| bundleType<sup>12+</sup> | [bundleManager.BundleType](js-apis-bundleManager.md#bundletype) | No| No| Type of the bundle running in the process.<br>**Atomic service API**: This API can be used in atomic services since API version 12.|
33| appCloneIndex<sup>12+</sup> | number   | No  | Yes  | Index of an application clone.<br>**Atomic service API**: This API can be used in atomic services since API version 12. |
34
35## How to Use
36
37The process information is obtained by calling [getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation) of the appManager module.
38
39**Example**
40
41```ts
42import { appManager } from '@kit.AbilityKit';
43
44appManager.getRunningProcessInformation((error, data) => {
45  if (error) {
46    console.error(`getRunningProcessInformation fail, error: ${JSON.stringify(error)}`);
47  } else {
48    console.log(`getRunningProcessInformation success, data: ${JSON.stringify(data)}`);
49  }
50});
51```
52