1# @ohos.app.ability.StartOptions (StartOptions) 2 3**StartOptions** is used as an input parameter of [startAbility()](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1) to specify the window mode of an ability. 4 5> **NOTE** 6> 7> - 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. 8> 9> - The APIs of this module can be used only in the stage model. 10 11## Modules to Import 12 13```ts 14import { StartOptions } from '@kit.AbilityKit'; 15``` 16 17## Properties 18 19**System capability**: SystemCapability.Ability.AbilityRuntime.Core 20 21| Name| Type| Read-only| Optional| Description| 22| -------- | -------- | -------- | -------- | -------- | 23| windowMode<sup>12+<sup> | number | No| Yes| Window mode when the ability is started. For details, see [WindowMode](./js-apis-app-ability-abilityConstant.md#windowmode12).| 24| displayId | number | No| Yes| Display ID mode. The default value is **0**, indicating the current display.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 25| withAnimation<sup>11+</sup> | boolean | No| Yes| Whether the ability has the animation effect.| 26| windowLeft<sup>11+</sup> | number | No| Yes| Left position of the window.| 27| windowTop<sup>11+</sup> | number | No| Yes| Top position of the window.| 28| windowWidth<sup>11+</sup> | number | No| Yes| Width of the window.| 29| windowHeight<sup>11+</sup> | number | No| Yes| Height of the window.| 30| processMode<sup>12+</sup> | [contextConstant.ProcessMode](js-apis-app-ability-contextConstant.md#processmode12) | No| Yes| Process mode.<br>**Constraints**:<br>1. This property takes effect only on tablets.<br>2. This property takes effect only in [UIAbilityContext.startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1).<br>3. **processMode** and **startupVisibility** must be set in pair.| 31| startupVisibility<sup>12+</sup> | [contextConstant.StartupVisibility](js-apis-app-ability-contextConstant.md#startupvisibility12) | Yes| No| Visibility of the ability after it is started.<br>**Constraints**:<br>1. This property takes effect only on tablets.<br>2. This property takes effect only in [UIAbilityContext.startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1).<br>3. **processMode** and **startupVisibility** must be set in pair.| 32 33**Example** 34 35 ```ts 36 import { UIAbility, Want, StartOptions } from '@kit.AbilityKit'; 37 import { BusinessError } from '@kit.BasicServicesKit'; 38 39 export default class EntryAbility extends UIAbility { 40 41 onForeground() { 42 let want: Want = { 43 deviceId: '', 44 bundleName: 'com.example.myapplication', 45 abilityName: 'EntryAbility' 46 }; 47 let options: StartOptions = { 48 displayId: 0 49 }; 50 51 try { 52 this.context.startAbility(want, options, (err: BusinessError) => { 53 if (err.code) { 54 // Process service logic errors. 55 console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); 56 return; 57 } 58 // Carry out normal service processing. 59 console.info('startAbility succeed'); 60 }); 61 } catch (err) { 62 // Process input parameter errors. 63 let code = (err as BusinessError).code; 64 let message = (err as BusinessError).message; 65 console.error(`startAbility failed, code is ${code}, message is ${message}`); 66 } 67 } 68 } 69 ``` 70