• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AbilityRunningInfo
2
3The **AbilityRunningInfo** module defines the running information and state of an ability.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8
9## Usage
10
11The ability running information is obtained by calling [getAbilityRunningInfos](js-apis-app-ability-abilityManager.md#getabilityrunninginfos) in **abilityManager**.
12
13## Attributes
14
15**System capability**: SystemCapability.Ability.AbilityRuntime.Core
16
17**System API**: This is a system API and cannot be called by third-party applications.
18
19| Name| Type| Readable| Writable| Description|
20| -------- | -------- | -------- | -------- | -------- |
21| ability | ElementName | Yes| No| Information that matches an ability. |
22| pid | number | Yes| No| Process ID.|
23| uid | number | Yes| No| User ID. |
24| processName | string | Yes| No| Process name. |
25| startTime | number | Yes| No| Ability start time. |
26| abilityState | [abilityManager.AbilityState](js-apis-app-ability-abilityManager.md#abilitystate) | Yes| No| Ability state. |
27
28**Example**
29
30```ts
31import abilitymanager from '@ohos.application.abilityManager';
32abilitymanager.getAbilityRunningInfos((err,data) => {
33    console.log('getAbilityRunningInfos err: '  + err + ' data: ' + JSON.stringify(data));
34    for (let i = 0; i < data.length; i++) {
35        let abilityinfo = data[i];
36        console.log('abilityinfo.ability: ' + JSON.stringify(abilityinfo.ability));
37        console.log('abilityinfo.pid: ' + JSON.stringify(abilityinfo.pid));
38        console.log('abilityinfo.uid: ' + JSON.stringify(abilityinfo.uid));
39        console.log('abilityinfo.processName: ' + JSON.stringify(abilityinfo.processName));
40        console.log('abilityinfo.startTime: ' + JSON.stringify(abilityinfo.startTime));
41        console.log('abilityinfo.abilityState: ' + JSON.stringify(abilityinfo.abilityState));
42    }
43});
44```
45