• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AbilityRunningInfo
2
3> **NOTE**
4>
5> 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.
6
7
8Provides ability running information.
9
10## Modules to Import
11
12```js
13import abilitymanager from '@ohos.application.abilityManager';
14```
15
16## Usage
17
18
19The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**.
20
21```js
22import abilitymanager from '@ohos.application.abilityManager';
23abilitymanager.getAbilityRunningInfos((err,data) => {
24    console.log("getAbilityRunningInfos err: "  + err + " data: " + JSON.stringify(data));
25});
26```
27
28## Attributes
29
30**System capability**: SystemCapability.Ability.AbilityRuntime.Core
31
32| Name| Type| Readable| Writable| Description|
33| -------- | -------- | -------- | -------- | -------- |
34| ability | ElementName | Yes| No| Information that matches an ability. |
35| pid | number | Yes| No| Process ID.|
36| uid | number | Yes| No| User ID. |
37| processName | string | Yes| No| Process name. |
38| startTime | number | Yes| No| Ability start time. |
39| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. |
40
41
42## abilityManager.AbilityState
43
44Enumerates the ability states.
45
46**System capability**: SystemCapability.Ability.AbilityRuntime.Core
47
48| Name| Value| Description|
49| -------- | -------- | -------- |
50| INITIAL | 0 | The ability is in the initial state.|
51| FOREGROUND | 9 | The ability is in the foreground state. |
52| BACKGROUND | 10 | The ability is in the background state. |
53| FOREGROUNDING | 11 | The ability is in the foregrounding state. |
54| BACKGROUNDING | 12 | The ability is in the backgrounding state. |
55