openharmony 鸿蒙 js-apis-app-ability-wantConstant

2025-06-12 浏览 (1)

@ohos.app.ability.wantConstant (wantConstant)

The wantConstant module provides the actions, entities, and flags used in Want objects.

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.

Modules to Import

import { wantConstant } from '@kit.AbilityKit';

Params

Defines Params (specifying the action that can be performed) in the Want.

System capability: SystemCapability.Ability.AbilityBase

NameValueDescription
ABILITY_BACK_TO_OTHER_MISSION_STACKability.params.backToOtherMissionStackAction of redirection back across mission stacks.
Atomic service API: This API can be used in atomic services since API version 11.
ABILITY_RECOVERY_RESTART10+ohos.ability.params.abilityRecoveryRestartAction of recovering an ability from a fault and restarting it.
Atomic service API: This API can be used in atomic services since API version 11.
CONTENT_TITLE_KEY10+ohos.extra.param.key.contentTitleAction of sharing the content title.
Atomic service API: This API can be used in atomic services since API version 11.
SHARE_ABSTRACT_KEY10+ohos.extra.param.key.shareAbstractAction of sharing the abstract.
Atomic service API: This API can be used in atomic services since API version 11.
SHARE_URL_KEY10+ohos.extra.param.key.shareUrlAction of sharing the URL.
Atomic service API: This API can be used in atomic services since API version 11.
SUPPORT_CONTINUE_PAGE_STACK_KEY10+ohos.extra.param.key.supportContinuePageStackAction of migrating page stack information during cross-device migration. The default value is true, indicating that page stack information is automatically migrated.
Atomic service API: This API can be used in atomic services since API version 11.
SUPPORT_CONTINUE_SOURCE_EXIT_KEY10+ohos.extra.param.key.supportContinueSourceExitAction of exiting the application on the source device during cross-device migration. The default value is true, indicating that the application on the source device automatically exits.
Atomic service API: This API can be used in atomic services since API version 11.
SHOW_MODE_KEY12+ohos.extra.param.key.showModeShow mode. For details, see wantConstant.ShowMode.
Atomic service API: This API can be used in atomic services since API version 12.
PARAMS_STREAM12+ability.params.streamFile URIs to be authorized to the target ability. The value must be an array of file URIs of the string type. For details about how to obtain the file URI, see fileUri.
Atomic service API: This API can be used in atomic services since API version 12.
APP_CLONE_INDEX_KEY12+ohos.extra.param.key.appCloneIndexIndex of an application clone.
Atomic service API: This API can be used in atomic services since API version 12.
CALLER_REQUEST_CODE12+ohos.extra.param.key.callerRequestCodeRequest code that uniquely identifies the caller of startAbilityForResult or openLink. When either of the APIs is called to start an ability, the target ability returns the result to the caller based on the request code.
Atomic service API: This API can be used in atomic services since API version 12.
PAGE_PATH12+ohos.param.atomicservice.pagePathPath of page parameters.
Atomic service API: This API can be used in atomic services since API version 12.
ROUTER_NAME12+ohos.param.atomicservice.routerNameName of the page router.
Atomic service API: This API can be used in atomic services since API version 12.
PAGE_SOURCE_FILE12+ohos.param.atomicservice.pageSourceFileSource file of the page.
Atomic service API: This API can be used in atomic services since API version 12.
BUILD_FUNCTION12+ohos.param.atomicservice.buildFunctionBuild function.
Atomic service API: This API can be used in atomic services since API version 12.
SUB_PACKAGE_NAME12+ohos.param.atomicservice.subpackageNameName of a subpackage.
Atomic service API: This API can be used in atomic services since API version 12.
APP_INSTANCE_KEY14+ohos.extra.param.key.appInstanceSpecific application instance.
CREATE_APP_INSTANCE_KEY14+ohos.extra.param.key.createAppInstanceAction of creating an application instance.
CALLER_APP_CLONE_INDEX14+ohos.param.callerAppCloneIndexClone index of the caller.
APP_LAUNCH_TRUSTLIST17+ohos.params.appLaunchTrustListFilter list of applications for implicit launch. Only applications in the list are matched during implicit launch. The value is an array of AppIdentifiers of the string type. The filter list supports a maximum of 50 applications. Passing an empty array will have no effect.
Atomic service API: This API can be used in atomic services since API version 17.
LAUNCH_REASON_MESSAGE18+ohos.params.launchReasonMessageReason for starting the ability when the caller starts the target ability. The caller must be a system application and must request the ohos.permission.SET_LAUNCH_REASON_MESSAGE permission. Currently, the value can only be ReasonMessage_SystemShare.
Atomic service API: This API can be used in atomic services since API version 18.

Flags

Enumerates the flags that specify how the Want will be handled.

System capability: SystemCapability.Ability.AbilityBase

NameValueDescription
FLAG_AUTH_READ_URI_PERMISSION0x00000001Grant the permission to read the URI.
Atomic service API: This API can be used in atomic services since API version 11.
FLAG_AUTH_WRITE_URI_PERMISSION0x00000002Grant the permission to write data to the URI.
Atomic service API: This API can be used in atomic services since API version 11.
FLAG_AUTH_PERSISTABLE_URI_PERMISSION12+0x00000040Make the URI persistent. It takes effect only on 2-in-1 devices and tablets.
FLAG_INSTALL_ON_DEMAND0x00000800Install the ability if it has not been installed.
Atomic service API: This API can be used in atomic services since API version 11.
FLAG_START_WITHOUT_TIPS11+0x40000000Do not display any tips if the ability implicitly started does not match any application.
FLAG_ABILITY_ON_COLLABORATE18+0x00002000In multi-device collaboration scenario, the caller application must initiate a request through the DMS, with this flag included in the Flags field, in order to invoke the lifecycle callback onCollaborate(wantParam) of the target application.

ShowMode12+

Enumerates the modes used to show the atomic service startup.

Atomic service API: This API can be used in atomic services since API version 12.

System capability: SystemCapability.Ability.AbilityBase

NameValueDescription
WINDOW0An independent window is used to show the ability startup.
EMBEDDED_FULL1An embedded full-screen is used to show the ability startup.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Ability Kit

harmony 鸿蒙AbilityAccessControl

harmony 鸿蒙AbilityBase

harmony 鸿蒙AbilityBase_Element

harmony 鸿蒙AbilityRuntime

harmony 鸿蒙bundle

harmony 鸿蒙OH_NativeBundle_ApplicationInfo

harmony 鸿蒙OH_NativeBundle_ElementName

harmony 鸿蒙ability_access_control.h

harmony 鸿蒙ability_base_common.h

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/EHlaF4