js-apis-abilityrunninginfo.md 1.7 KB
Newer Older
W
wusongqing 已提交
1 2
# AbilityRunningInfo

3
> **NOTE**<br>
W
wusongqing 已提交
4 5 6 7 8 9 10 11 12
> 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.


Provides ability running information.


## Usage


W
wusongqing 已提交
13
The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**.
W
wusongqing 已提交
14 15


W
wusongqing 已提交
16 17

```js
W
wusongqing 已提交
18 19 20 21 22 23 24
import abilitymanager from '@ohos.application.abilityManager';
abilitymanager.getAbilityRunningInfos((err,data) => { 
    console.log("getAbilityRunningInfos err: "  + err + " data: " + JSON.stringify(data));
});
```

## Attributes
W
wusongqing 已提交
25

W
wusongqing 已提交
26
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
W
wusongqing 已提交
27

28 29 30 31 32 33 34 35
 | Name | Type | Readable | Writable | Description |
 | -------- | -------- | -------- | -------- | -------- |
 | ability | ElementName | Yes | No | Information that matches an ability. | 
 | pid | number | Yes | No | Process ID. | 
 | uid | number | Yes | No | User ID. | 
 | processName | string | Yes | No | Process name. | 
 | startTime | number | Yes | No | Ability start time. | 
 | abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes | No | Ability state. | 
W
wusongqing 已提交
36 37 38


## abilityManager.AbilityState
W
wusongqing 已提交
39

W
wusongqing 已提交
40 41
Enumerates the ability states.

W
wusongqing 已提交
42 43
**System capability**: SystemCapability.Ability.AbilityRuntime.Core

44 45 46 47 48 49 50
 | Name | Value | Description | 
 | -------- | -------- | -------- |
 | INITIAL | 0 | The ability is in the initial state. | 
 | FOREGROUND | 9 | The ability is in the foreground state. | 
 | BACKGROUND | 10 | The ability is in the background state. | 
 | FOREGROUNDING | 11 | The ability is in the foregrounding state. | 
 | BACKGROUNDING | 12 | The ability is in the backgrounding state. |