harmony 鸿蒙StartAbilityParameter
StartAbilityParameter
The StartAbilityParameter module defines the parameters for starting an ability. The parameters can be used as input parameters in startAbility to start the specified ability.
NOTE
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. The APIs of this module can be used only in the FA model.
Modules to Import
import ability from '@ohos.ability.ability';
Attributes
System capability: SystemCapability.Ability.AbilityRuntime.FAModel
Name | Type | Mandatory | Description |
---|---|---|---|
want | Want | Yes | Want information about the target ability. |
abilityStartSetting | {[key: string]: any} | No | Special attribute of the target ability. This attribute can be passed in the call. |
Example
import ability from '@ohos.ability.ability';
import featureAbility from '@ohos.ability.featureAbility';
import Want from '@ohos.app.ability.Want';
let want: Want = {
bundleName: 'com.example.abilityStartSettingApp2',
abilityName: 'com.example.abilityStartSettingApp.EntryAbility',
};
let startAbilityParameter: ability.StartAbilityParameter = {
want : want,
abilityStartSetting : {
abilityBounds : [100,200,300,400],
windowMode :
featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED,
displayId : 1,
}
};
try {
featureAbility.startAbility(startAbilityParameter, (error, data) => {
if (error && error.code !== 0) {
console.error(`startAbility fail, error: ${JSON.stringify(error)}`);
} else {
console.log(`startAbility success, data: ${JSON.stringify(data)}`);
}
});
} catch(error) {
console.error(`startAbility error: ${JSON.stringify(error)}`);
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙System Common Events (To Be Deprecated Soon)
harmony 鸿蒙System Common Events
harmony 鸿蒙API Reference Document Description
harmony 鸿蒙Enterprise Device Management Overview (for System Applications Only)
harmony 鸿蒙BundleStatusCallback
harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager)
harmony 鸿蒙@ohos.distributedBundle (Distributed Bundle Management)
harmony 鸿蒙@ohos.bundle (Bundle)
harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦