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 [registerApplicationStateObserver](js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8). 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## Modules to Import 10 11```ts 12import appManager from '@ohos.application.appManager'; 13``` 14 15**System capability**: SystemCapability.Ability.AbilityRuntime.Core 16 17| Name | Type | Readable| Writable| Description | 18| ----------------------- | ---------| ---- | ---- | ------------------------- | 19| pid | number | Yes | No | Process ID. | 20| bundleName | string | Yes | No | Bundle name. | 21| abilityName | string | Yes | No | Ability name. | 22| uid | number | Yes | No | User ID. | 23| state | number | Yes | No | [Ability state](#ability-states). | 24| moduleName<sup>9+</sup> | string | Yes | No | Name of the HAP file to which the ability belongs. | 25| abilityType | number | Yes | No | [Ability type](#ability-types), which can be **page** or **service**.| 26 27#### Ability States 28 29| Value | State | Description | 30| ---- | -------------------------- | ---------------------- | 31| 0 | ABILITY_STATE_CREATE | The ability is being created. | 32| 1 | ABILITY_STATE_READY | The ability has been created. | 33| 2 | ABILITY_STATE_FOREGROUND | The ability is running in the foreground. | 34| 3 | ABILITY_STATE_FOCUS | The ability has focus. | 35| 4 | ABILITY_STATE_BACKGROUND | The ability is running in the background. | 36| 5 | ABILITY_STATE_TERMINATED | The ability is terminated. | 37| 8 | ABILITY_STATE_CONNECTED | The background service is connected to the client.| 38| 9 | ABILITY_STATE_DISCONNECTED | The background service is disconnected from the client.| 39 40#### Ability Types 41 42| Value | State | Description | 43| ---- | ------- | --------------------- | 44| 0 | UNKNOWN | Unknown type. | 45| 1 | PAGE | Ability that has the UI. | 46| 2 | SERVICE | Ability that provides the background service.| 47