• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ProcessInfo
2
3The **ProcessInfo** module defines process information. You can use [getProcessInfo](js-apis-inner-app-context.md#contextgetprocessinfo7) to obtain information about the processes running on the current ability.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Modules to Import
10
11```ts
12import featureAbility from '@ohos.ability.featureAbility';
13```
14
15**System capability**: SystemCapability.Ability.AbilityRuntime.Core
16
17| Name| Type| Readable| Writable| Description|
18| -------- | -------- | -------- | -------- | -------- |
19| pid | number | Yes| No| Process ID.|
20| processName | string | Yes| No| Process name.|
21
22**Example**
23```ts
24import featureAbility from '@ohos.ability.featureAbility';
25
26let context = featureAbility.getContext();
27context.getProcessInfo((err, data) => {
28    if (err.code !== 0) {
29        console.info('getProcessInfo err: ' + JSON.stringify(err) + 'data: ' + JSON.stringify(data));
30        let pid = data.pid;
31        let processName = data.processName;
32    }
33});
34```
35
36