• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ProcessInformation
2
3The **ProcessInformation** module defines the running information of a process.
4
5> **NOTE**
6>
7> 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.
8
9## Modules to Import
10
11```ts
12import appManager from '@ohos.app.ability.appManager';
13```
14
15## How to Use
16
17The process information is obtained by calling [getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9) of the **appManager** module.
18
19```ts
20import appManager from '@ohos.app.ability.appManager';
21
22appManager.getRunningProcessInformation((error, data) => {
23    if (error) {
24        console.error(`getRunningProcessInformation fail, error: ${JSON.stringify(error)}`);
25    } else {
26        console.log(`getRunningProcessInformation success, data: ${JSON.stringify(data)}`);
27    }
28});
29```
30
31## Attributes
32
33**System capability**: SystemCapability.Ability.AbilityRuntime.Core
34
35| Name| Type| Readable| Writable| Description|
36| -------- | -------- | -------- | -------- | -------- |
37| pid | number | Yes| No| Process ID.|
38| uid | number | Yes| No| User ID.|
39| processName | string | Yes| No| Process name.|
40| bundleNames | Array<string> | Yes| No| Names of all running bundles in the process.|
41| state<sup>10+</sup> | [appManager.ProcessState](js-apis-app-ability-appManager.md#processstate)| Yes| No| Running status of the process.|
42