harmony 鸿蒙@ohos.app.ability.StartOptions (StartOptions)
@ohos.app.ability.StartOptions (StartOptions)
StartOptions is used as an input parameter of startAbility() to specify the window mode of an ability.
NOTE
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. The APIs of this module can be used only in the stage model.
Modules to Import
import StartOptions from '@ohos.app.ability.StartOptions';
Attributes
System capability: SystemCapability.Ability.AbilityRuntime.Core
Name | Type | Mandatory | Description |
---|---|---|---|
windowMode | number | No | Window mode. System API: This is a system API and cannot be called by third-party applications. |
displayId | number | No | Display ID. The default value is 0, indicating the current display. |
Example
import missionManager from '@ohos.app.ability.missionManager';
import StartOptions from '@ohos.app.ability.StartOptions';
import { BusinessError } from '@ohos.base';
try {
missionManager.getMissionInfos('', 10, (error, missions) => {
if (error) {
console.error(`getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`);
return;
}
console.log(`size = ${missions.length}`);
console.log(`missions = ${JSON.stringify(missions)}`);
let id = missions[0].missionId;
let startOptions: StartOptions = {
windowMode : 101,
displayId: 0
};
missionManager.moveMissionToFront(id, startOptions).then(() => {
console.log('moveMissionToFront is called');
});
});
} catch (paramError) {
let code = (paramError as BusinessError).code;
let message = (paramError as BusinessError).message;
console.error(`error: ${code}, ${message}`);
}
你可能感兴趣的鸿蒙文章
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框自动聚焦