1 # AppStateData (System API) 2 3The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager-sys.md#appmanagergetforegroundapplications). 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> The APIs provided by this module are system APIs. 9 10## Modules to Import 11 12```ts 13import appManager from '@ohos.app.ability.appManager'; 14``` 15 16## Attributes 17 18**System capability**: SystemCapability.Ability.AbilityRuntime.Core 19 20**System API**: This module is marked as @systemapi and not visible to third-party applications. 21 22| Name | Type | Mandatory | Description | 23| ------------------------- | ------ | ---- | --------- | 24| bundleName<sup>8+</sup> | string | No | Bundle name.| 25| uid<sup>8+</sup> | number | No | UID of the application. | 26| state<sup>8+</sup> | number | No | Application state.<br>**0**: The application is being initialized.<br>**1**: The application has been initialized and is ready.<br>**2**: The application is running in the foreground.<br>**3**: The application is having the focus. (This state is reserved.)<br>**4**: The application is running in the background.<br>**5**: The application has exited.| 27| isSplitScreenMode<sup>11+</sup> | boolean | No| Whether the application is in split-screen mode.<br>**true**: The application is in split-screen mode.<br>**false**: The application is not in split-screen mode.| 28| isFloatingWindowMode<sup>11+</sup> | boolean | No| Whether the application is in floating window mode.<br>**true**: The application is in floating window mode.<br>**false**: The application is not in floating window mode.| 29 30**Example** 31 32```ts 33import appManager from '@ohos.app.ability.appManager'; 34 35function getForegroundAppInfos() { 36 appManager.getForegroundApplications((error, data) => { 37 if (error) { 38 console.log(`getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`); 39 return; 40 } 41 for (let i = 0; i < data.length; i++) { 42 let appStateData = data[i]; 43 console.log(`appStateData.bundleName: ${appStateData.bundleName}`); 44 console.log(`appStateData.uid: ${appStateData.uid}`); 45 console.log(`appStateData.state: ${appStateData.state}`); 46 console.log(`appStateData.isSplitScreenMode: ${appStateData.isSplitScreenMode}`); 47 console.log(`appStateData.isFloatingWindowMode: ${appStateData.isFloatingWindowMode}`); 48 } 49 }); 50} 51``` 52