1# @ohos.app.ability.AbilityConstant (Ability-related Constants) (System APIs) 2 3<!--Kit: Ability Kit--> 4<!--Subsystem: Ability--> 5<!--Owner: @littlejerry1--> 6<!--Designer: @ccllee1--> 7<!--Tester: @lixueqing513--> 8<!--Adviser: @huipeizi--> 9 10AbilityConstant provides enums related to abilities, including the window mode. 11 12> **NOTE** 13> 14> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 15> 16> The APIs of this module can be used only in the stage model. 17> 18> This topic describes only system APIs provided by the module. For details about its public APIs, see [@ohos.app.ability.AbilityConstant (Ability-related Constants)](js-apis-app-ability-abilityConstant.md). 19 20## Modules to Import 21 22```ts 23import { AbilityConstant } from '@kit.AbilityKit'; 24``` 25 26## WindowMode<sup>12+</sup> 27 28Enumerates the window modes in which an ability can be displayed at startup. It can be used in **startAbility()** to specify the window mode when the ability is started. 29 30**System capability**: SystemCapability.Ability.AbilityRuntime.Core 31 32**System API**: This is a system API. 33 34| Name | Value| Description | 35| --- | --- | --- | 36| WINDOW_MODE_UNDEFINED | 0 | Undefined window mode. | 37| WINDOW_MODE_FLOATING | 102 | The ability is displayed in a floating window.| 38 39**Example** 40 41```ts 42import { UIAbility, StartOptions, Want, AbilityConstant } from '@kit.AbilityKit'; 43import { BusinessError } from '@kit.BasicServicesKit'; 44 45let want: Want = { 46 bundleName: 'com.example.myapplication', 47 abilityName: 'EntryAbility' 48}; 49let option: StartOptions = { 50 windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FULLSCREEN 51}; 52 53// Ensure that the context is obtained. 54export default class MyAbility extends UIAbility { 55 onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) { 56 this.context.startAbility(want, option).then(() => { 57 console.log('Succeed to start ability.'); 58 }).catch((error: BusinessError) => { 59 console.error(`Failed to start ability with error: ${JSON.stringify(error)}`); 60 }); 61 } 62} 63``` 64