• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ProcessInformation
2
3ProcessInformation模块提供对进程运行信息进行查询的能力。
4
5> **说明:**
6>
7> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
8
9## 导入模块
10
11```ts
12import appManager from '@ohos.app.ability.appManager';
13```
14
15## 使用说明
16
17通过appManager的[getRunningProcessInformation](js-apis-app-ability-appManager.md#appmanagergetrunningprocessinformation9)来获取。
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## 属性
32
33**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
34
35| 名称 | 类型 | 可读 | 可写 | 说明 |
36| -------- | -------- | -------- | -------- | -------- |
37| pid | number | 是 | 否 | 进程ID。 |
38| uid | number | 是 | 否 | 用户ID。 |
39| processName | string | 是 | 否 | 进程名称。 |
40| bundleNames | Array<string> | 是 | 否 | 进程中所有运行的Bundle名称。 |
41| state<sup>10+</sup> | [appManager.ProcessState](js-apis-app-ability-appManager.md#processstate)| 是 | 否 | 当前进程运行状态。|
42