• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# ProcessRunningInfo
2
3本模块提供对进程运行信息进行查询的能力。
4
5> **说明:**
6> - 本模块接口从API version 9 开始废弃,建议使用[ProcessInformation<sup>9+</sup>](js-apis-inner-application-processInformation.md)替代。
7> - 本模块首批接口从API version 8 开始支持。
8
9## 导入模块
10
11```ts
12import appManager from '@ohos.app.ability.appManager';
13```
14
15## 属性
16
17**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
18
19| 名称 | 类型 | 可读 | 可写 | 说明 |
20| -------- | -------- | -------- | -------- | -------- |
21| pid | number | 是 | 否 | 进程ID。 |
22| uid | number | 是 | 否 | 用户ID。 |
23| processName | string | 是 | 否 | 进程名称。 |
24| bundleNames | Array&lt;string&gt; | 是 | 否 | 进程中所有运行的包名称。 |
25
26## 使用说明
27
28通过appManager中[getProcessRunningInfos](js-apis-application-appManager.md#appmanagergetprocessrunninginfosdeprecated)方法来获取。
29
30**示例:**
31```ts
32import appManager from '@ohos.application.appManager';
33
34appManager.getProcessRunningInfos().then((data) => {
35    console.log('success:' + JSON.stringify(data));
36}).catch((error) => {
37    console.log('failed:' + JSON.stringify(error));
38});
39```
40