1# AbilityStateData 2 3The **AbilityStateData** module defines the ability state information, which can be obtained through the **onAbilityStateChanged** lifecycle callback of [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md). The callback can be invoked after a lifecycle change listener is registered through [on](js-apis-app-ability-appManager.md#appmanageronapplicationstate). 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 14. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8 9## Modules to Import 10 11```ts 12import { appManager } from '@kit.AbilityKit'; 13``` 14 15## Properties 16 17**System capability**: SystemCapability.Ability.AbilityRuntime.Core 18 19| Name | Type | Readable| Writable| Description | 20| ----------------------- | ---------| ---- | ---- | ------------------------- | 21| pid | number | Yes | No | Process ID. | 22| bundleName | string | Yes | No | Bundle name. | 23| abilityName | string | Yes | No | Ability name. | 24| uid | number | Yes | No | User ID. | 25| state | number | Yes | No | Ability state.<br>- In the stage model, the states of a UIAbility are described in [Ability States](#ability-states), and the states of an ExtensionAbility are described in [ExtensionAbility States](#extensionability-states).<br>- In the FA model, the states of an ability are described in [Ability States](#ability-states). | 26| moduleName<sup>9+</sup> | string | Yes | No | Name of the HAP file to which the ability belongs. | 27| abilityType | number | Yes | No | [Ability type](#ability-types), which can be **page** or **service**.| 28| isAtomicService<sup>12+</sup>| boolean | Yes | No | Whether the ability belongs to an atomic service.<br>**true**: The ability belongs to an atomic service.<br>**false**: The ability does not belong to an atomic service. | 29| appCloneIndex | number | Yes | No | Index of an application clone. | 30 31### Ability States 32 33| Value | State | Description | 34| ---- | -------------------------- | ---------------------- | 35| 0 | ABILITY_STATE_CREATE | The ability is being created. | 36| 1 | ABILITY_STATE_READY | The ability has been created. | 37| 2 | ABILITY_STATE_FOREGROUND | The ability is running in the foreground. | 38| 3 | ABILITY_STATE_FOCUS | The ability has focus. | 39| 4 | ABILITY_STATE_BACKGROUND | The ability is running in the background. | 40| 5 | ABILITY_STATE_TERMINATED | The ability is terminated. | 41| 7 | ABILITY_STATE_CONNECTED | The background service is connected to the client.| 42| 8 | ABILITY_STATE_DISCONNECTED | The background service is disconnected from the client.| 43 44### ExtensionAbility States 45| Value | State | Description | 46| ---- | -------------------------- | ---------------------- | 47| 0 | EXTENSION_STATE_CREATE | The ExtensionAbility is being created. | 48| 1 | EXTENSION_STATE_READY | The ExtensionAbility has been created. | 49| 2 | EXTENSION_STATE_CONNECTED | The ExtensionAbility is connected to the client. | 50| 3 | EXTENSION_STATE_DISCONNECTED | The ExtensionAbility is disconnected from the client.| 51| 4 | EXTENSION_STATE_TERMINATED | The ExtensionAbility is terminated. | 52 53### Ability Types 54 55| Value | Type | Description | 56| ---- | ------- | --------------------- | 57| 0 | UNKNOWN | Unknown type. | 58| 1 | PAGE | Ability that has the UI. | 59| 2 | SERVICE | Ability that provides the background service.| 60| 3 | DATA | Ability that provides the data service. | 61| 4 | FORM | Ability that provides the widget service. | 62| 5 | EXTENSION | Ability that provides extension capabilities.| 63