js-apis-configuration.md 1.3 KB
Newer Older
W
wusongqing 已提交
1 2
# Configuration

W
wusongqing 已提交
3 4
> **NOTE**
> 
W
wusongqing 已提交
5 6 7 8 9 10
> 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.

Provides the configuration for the environment where the ability is running.

## Modules to Import

W
wusongqing 已提交
11
```js
W
wusongqing 已提交
12 13 14 15 16
import Configuration from '@ohos.application.Configuration';
```

## Attributes

W
wusongqing 已提交
17 18
**System capability**: SystemCapability.Ability.AbilityBase

W
wusongqing 已提交
19
  | Name| Type| Readable| Writable| Description| 
W
wusongqing 已提交
20
| -------- | -------- | -------- | -------- | -------- |
W
wusongqing 已提交
21 22 23 24 25
| language | string | Yes| Yes| Language of the application.| 
| colorMode | [ColorMode](js-apis-configurationconstant.md) | Yes| Yes| Color mode, which can be **COLOR_MODE_LIGHT** or **COLOR_MODE_DARK**. The default value is **COLOR_MODE_LIGHT**.| 
| direction<sup>9+</sup> | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.| 
| screenDensity<sup>9+</sup>  | ScreenDensity | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).| 
| displayId<sup>9+</sup>  | number | Yes| No| ID of the display where the application is located.|