harmony 鸿蒙@ohos.app.ability.AbilityConstant (AbilityConstant) (System API)
@ohos.app.ability.AbilityConstant (AbilityConstant) (System API)
The AbilityConstant module defines the enums of the window types in the UIAbility.
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.
This topic describes only system APIs provided by the module. For details about its public APIs, see @ohos.app.ability.AbilityConstant (AbilityConstant).
Modules to Import
import { AbilityConstant } from '@kit.AbilityKit';
WindowMode12+
Enumerates the window modes in which an ability can be displayed at startup. It can be used in startAbility() to specify the window mode when the ability is started.
System capability: SystemCapability.Ability.AbilityRuntime.Core
System API: This is a system API.
Name | Value | Description |
---|---|---|
WINDOW_MODE_UNDEFINED | 0 | Undefined window mode. |
WINDOW_MODE_FLOATING | 102 | The ability is displayed in a floating window. |
Example
import { UIAbility, StartOptions, Want, AbilityConstant } from '@kit.AbilityKit';
import { BusinessError } from '@kit.BasicServicesKit';
let want: Want = {
bundleName: 'com.example.myapplication',
abilityName: 'EntryAbility'
};
let option: StartOptions = {
windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FULLSCREEN
};
// Ensure that the context is obtained.
class MyAbility extends UIAbility {
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam) {
this.context.startAbility(want, option).then(() => {
console.log('Succeed to start ability.');
}).catch((error: BusinessError) => {
console.error('Failed to start ability with error: ${JSON.stringify(error)}');
});
}
}
你可能感兴趣的鸿蒙文章
harmony 鸿蒙AbilityAccessControl
harmony 鸿蒙OH_NativeBundle_ApplicationInfo
harmony 鸿蒙OH_NativeBundle_ElementName
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦