1e41f4b71Sopenharmony_ci# ProcessInfo 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ci定义进程信息,可以通过[getProcessInfo](js-apis-inner-app-context.md#contextgetprocessinfo7)获取当前Ability运行的进程信息。 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **说明:** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 本模块首批接口从API version 7开始支持,仅支持FA模型。后续版本的新增接口,采用上角标单独标记接口的起始版本。 8e41f4b71Sopenharmony_ci 9e41f4b71Sopenharmony_ci## 导入模块 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci```ts 12e41f4b71Sopenharmony_ciimport featureAbility from '@ohos.ability.featureAbility'; 13e41f4b71Sopenharmony_ci``` 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## 属性 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core 18e41f4b71Sopenharmony_ci 19e41f4b71Sopenharmony_ci| 名称 | 类型 | 可读 | 可写 | 说明 | 20e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | 21e41f4b71Sopenharmony_ci| pid | number | 是 | 否 | 进程ID。 | 22e41f4b71Sopenharmony_ci| processName | string | 是 | 否 | 进程名称。 | 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci**示例:** 25e41f4b71Sopenharmony_ci<!--code_no_check_fa--> 26e41f4b71Sopenharmony_ci```ts 27e41f4b71Sopenharmony_ciimport featureAbility from '@ohos.ability.featureAbility'; 28e41f4b71Sopenharmony_ci 29e41f4b71Sopenharmony_cilet context = featureAbility.getContext(); 30e41f4b71Sopenharmony_cicontext.getProcessInfo((error, data) => { 31e41f4b71Sopenharmony_ci if (error && error.code !== 0) { 32e41f4b71Sopenharmony_ci console.error(`getProcessInfo fail, error: ${JSON.stringify(error)}`); 33e41f4b71Sopenharmony_ci } else { 34e41f4b71Sopenharmony_ci console.log(`getProcessInfo success, data: ${JSON.stringify(data)}`); 35e41f4b71Sopenharmony_ci let pid = data.pid; 36e41f4b71Sopenharmony_ci let processName = data.processName; 37e41f4b71Sopenharmony_ci } 38e41f4b71Sopenharmony_ci}); 39e41f4b71Sopenharmony_ci``` 40e41f4b71Sopenharmony_ci 41