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| startWindowIcon<sup>14+</sup> | [image.PixelMap](../../reference/apis-image-kit/js-apis-image.md#pixelmap7) | No| Yes| Icon displayed on the launch page when the UIAbility is started in an application. If this property is not set, the value of **startWindowIcon** in the **module.json5** file is used by default.<br>**Constraints**:<br>1. This property takes effect only on tablets and 2-in-1 devices.<br>2. This property takes effect only in [UIAbilityContext.startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1).<br>3. The maximum size of an image is 600 MB.| 33| startWindowBackgroundColor<sup>14+</sup> | string | No| Yes| Background color of the launch page when the UIAbility is launched in an application. If this property is not set, the value of **startWindowBackground** in the **module.json5** file is used by default.<br>**Constraints**:<br>1. This property takes effect only on tablets and 2-in-1 devices.<br>2. This property takes effect only in [UIAbilityContext.startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability-1).| 34| supportWindowModes<sup>14+</sup> | Array\<[bundleManager.SupportWindowMode](./js-apis-bundleManager.md#supportwindowmode)> | No| Yes| Whether to display the maximize, minimize, or split-screen button when the UIAbility is launched in an application. If this property is not set, the value of **supportWindowMode** in the **module.json5** file is used by default.<br>**Constraints**:<br>This property takes effect only on tablets and 2-in-1 devices.| 35 36**Example** 37 38 ```ts 39 import { UIAbility, Want, StartOptions, bundleManager } from '@kit.AbilityKit'; 40 import { BusinessError } from '@kit.BasicServicesKit'; 41 import { image } from '@kit.ImageKit'; 42 43 export default class EntryAbility extends UIAbility { 44 onForeground() { 45 let want: Want = { 46 deviceId: '', 47 bundleName: 'com.example.myapplication', 48 abilityName: 'EntryAbility' 49 }; 50 51 let color = new ArrayBuffer(0); 52 let imagePixelMap: image.PixelMap; 53 image.createPixelMap(color, { 54 size: { 55 height: 100, 56 width: 100 57 } 58 }).then((data) => { 59 imagePixelMap = data; 60 let options: StartOptions = { 61 displayId: 0, 62 startWindowIcon: imagePixelMap, 63 startWindowBackgroundColor: '#00000000', 64 supportWindowModes: [ 65 bundleManager.SupportWindowMode.FULL_SCREEN, 66 bundleManager.SupportWindowMode.SPLIT, 67 bundleManager.SupportWindowMode.FLOATING 68 ] 69 }; 70 71 try { 72 this.context.startAbility(want, options, (err: BusinessError) => { 73 if (err.code) { 74 // Process service logic errors. 75 console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); 76 return; 77 } 78 // Carry out normal service processing. 79 console.info('startAbility succeed'); 80 }); 81 } catch (err) { 82 // Process input parameter errors. 83 let code = (err as BusinessError).code; 84 let message = (err as BusinessError).message; 85 console.error(`startAbility failed, code is ${code}, message is ${message}`); 86 } 87 }).catch((err: BusinessError) => { 88 console.error(`createPixelMap failed, code is ${err.code}, message is ${err.message}`); 89 }); 90 } 91 } 92 ``` 93