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