1# ProcessData 2 3The ProcessData module defines process data. If a lifecycle change listener is registered by calling [on](js-apis-app-ability-appManager.md#appmanageronapplicationstate), the **onProcessCreated** callback in [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md) is invoked when the lifecycle of an application or ability changes. 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 | Read-Only| Mandatory| Description | 20| ----------------------- | ---------| ---- | ---- | ------------------------- | 21| pid | number | No | Yes | Process ID. | 22| bundleName | string | No | Yes | Bundle name of the application. | 23| uid | number | No | Yes | UID of the application. | 24| isContinuousTask | boolean | No | Yes | Whether the task is a continuous task. The value **true** means that the task is a continuous task, and **false** means the opposite. | 25| isKeepAlive | boolean | No | Yes | Whether the process is a resident task. The value **true** means that the process is a resident, and **false** means the opposite. | 26| state | number | No | Yes | Application state. The options are as follows:<br>**0**: newly created.<br>**1**: ready.<br>**2**: running in the foreground.<br>**4**: running in the background.<br>**5**: terminated. | 27 28**Example** 29```ts 30import { appManager } from '@kit.AbilityKit'; 31 32let observerCode = appManager.on('applicationState', { 33 onForegroundApplicationChanged(appStateData) { 34 console.log(`onForegroundApplicationChanged appStateData: ${JSON.stringify(appStateData)}`); 35 }, 36 onAbilityStateChanged(abilityStateData) { 37 console.log(`onAbilityStateChanged onAbilityStateChanged: ${JSON.stringify(abilityStateData)}`); 38 }, 39 onProcessCreated(processData) { 40 console.log(`onProcessCreated onProcessCreated: ${JSON.stringify(processData)}`); 41 }, 42 onProcessDied(processData) { 43 console.log(`onProcessDied onProcessDied: ${JSON.stringify(processData)}`); 44 }, 45 onProcessStateChanged(processData) { 46 console.log(`onProcessStateChanged processData.pid : ${JSON.stringify(processData.pid)}`); 47 console.log(`onProcessStateChanged processData.bundleName : ${JSON.stringify(processData.bundleName)}`); 48 console.log(`onProcessStateChanged processData.uid : ${JSON.stringify(processData.uid)}`); 49 console.log(`onProcessStateChanged processData.isContinuousTask : ${JSON.stringify(processData.isContinuousTask)}`); 50 console.log(`onProcessStateChanged processData.isKeepAlive : ${JSON.stringify(processData.isKeepAlive)}`); 51 }, 52 onAppStarted(appStateData) { 53 console.log(`onAppStarted appStateData: ${JSON.stringify(appStateData)}`); 54 }, 55 onAppStopped(appStateData) { 56 console.log(`onAppStopped appStateData: ${JSON.stringify(appStateData)}`); 57 } 58}); 59``` 60