• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# StartAbilityParameter
2
3The **StartAbilityParameter** module defines the parameters for starting an ability. The parameters can be used as input parameters in [startAbility](js-apis-ability-featureAbility.md#featureabilitystartability) to start the specified ability.
4
5> **NOTE**
6>
7> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
8> The APIs of this module can be used only in the FA model.
9
10## Modules to Import
11
12```ts
13import ability from '@ohos.ability.ability';
14```
15
16**System capability**: SystemCapability.Ability.AbilityRuntime.FAModel
17
18| Name              |   Type  | Mandatory  | Description                                   |
19| ------------------- | -------- | ---- | -------------------------------------- |
20| want                | [Want](js-apis-application-want.md)|   Yes  | Want information about the target ability.                    |
21| abilityStartSetting | {[key: string]: any} | No   | Special attribute of the target ability. This attribute can be passed in the call.|
22
23**Example**
24```ts
25import featureAbility from '@ohos.ability.featureAbility';
26
27let Want = {
28    bundleName: 'com.example.abilityStartSettingApp2',
29    abilityName: 'com.example.abilityStartSettingApp.MainAbility',
30};
31
32let abilityStartSetting ={
33    [featureAbility.AbilityStartSetting.BOUNDS_KEY] : [100,200,300,400],
34    [featureAbility.AbilityStartSetting.WINDOW_MODE_KEY] :
35    featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED,
36    [featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1,
37};
38
39let startAbilityParameter: ability.StartAbilityParameter = {
40    want : Want,
41    abilityStartSetting : abilityStartSetting
42};
43
44featureAbility.startAbility(startAbilityParameter, (err, data)=>{
45    console.log('errCode : ' + JSON.stringify(err));
46    console.log('data : ' + JSON.stringify(data));
47});
48```
49