• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# AppStateData
2
3The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
4
5**System capability**: SystemCapability.Ability.AbilityRuntime.Core
6
7**System API**: This is a system API and cannot be called by third-party applications.
8
9| Name                     | Type  | Mandatory | Description      |
10| ------------------------- | ------ | ---- | --------- |
11| bundleName<sup>8+</sup>   | string | No  | Bundle name.|
12| uid<sup>8+</sup>          | number | No  | UID of the application.  |
13| state<sup>8+</sup>        | number | No  | Application state.|
14
15**Example**
16```ts
17import appManager from "@ohos.application.appManager";
18
19appManager.getForegroundApplications((error, data) => {
20    for (let i = 0; i < data.length; i++) {
21        let appStateData = data[i];
22        console.info('appStateData.bundleName: ' + appStateData.bundleName);
23        console.info('appStateData.uid: ' + appStateData.uid);
24        console.info('appStateData.state: ' + appStateData.state);
25    }
26});
27```
28