harmony 鸿蒙HapModuleInfo

  • 2025-06-12
  • 浏览 (2)

HapModuleInfo

The HapModuleInfo module defines the HAP module information. A third-party application can obtain its own HAP module information through getBundleInfoForSelf, with GET_BUNDLE_INFO_WITH_HAP_MODULE passed in for bundleFlags.

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.

HapModuleInfo

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
name string Yes No Module name.
Atomic service API: This API can be used in atomic services since API version 11.
icon string Yes No Module icon.
Atomic service API: This API can be used in atomic services since API version 11.
iconId number Yes No ID of the module icon.
Atomic service API: This API can be used in atomic services since API version 11.
label string Yes No Module label.
Atomic service API: This API can be used in atomic services since API version 11.
labelId number Yes No ID of the module label.
Atomic service API: This API can be used in atomic services since API version 11.
description string Yes No Module description.
Atomic service API: This API can be used in atomic services since API version 11.
descriptionId number Yes No ID of the module description.
Atomic service API: This API can be used in atomic services since API version 11.
mainElementName string Yes No Name of the UIAbility or ExtensionAbility that serves as the entry of the current module.
Atomic service API: This API can be used in atomic services since API version 11.
abilitiesInfo Array<AbilityInfo> Yes No Ability information. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ABILITY to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
extensionAbilitiesInfo Array<ExtensionAbilityInfo> Yes No ExtensionAbility information. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
metadata Array<Metadata> Yes No Metadata of the ability. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_METADATA to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
deviceTypes Array<string> Yes No Types of devices that can run the module.
Atomic service API: This API can be used in atomic services since API version 11.
installationFree boolean Yes No Whether the module supports the installation-free freature. Installation-free means that the module does not need to be explicitly installed through an app market. The value true means that the module supports installation-free, and false means the opposite.
Atomic service API: This API can be used in atomic services since API version 11.
hashValue string Yes No Hash value of the module.
Atomic service API: This API can be used in atomic services since API version 11.
type bundleManager.ModuleType Yes No Type of the module.
Atomic service API: This API can be used in atomic services since API version 11.
preloads Array<PreloadItem> Yes No Preloaded modules in the atomic service.
Atomic service API: This API can be used in atomic services since API version 11.
dependencies Array<Dependency> Yes No Dynamic shared libraries on which the module depends.
Atomic service API: This API can be used in atomic services since API version 11.
fileContextMenuConfig11+ string Yes No File menu configuration of the module. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_MENU to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
routerMap12+ Array<RouterItem> Yes No Router table configuration of the module. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE and GET_BUNDLE_INFO_WITH_ROUTER_MAP to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 12.
codePath12+ string Yes No Installation path of the module.
Atomic service API: This API can be used in atomic services since API version 12.
nativeLibraryPath12+ string Yes No Local library file path of the module in the application.

PreloadItem

Describes the preloaded module information in the atomic service.

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

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
moduleName string Yes No Module name.

Dependency

Describes the information about the dynamic shared library on which the module depends.

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

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
bundleName10+ string Yes No Name of the shared bundle on which the current module depends.
moduleName string Yes No Module name of the shared bundle on which the current module depends.
versionCode10+ number Yes No Version number of the shared bundle.

RouterItem12+

Describes the router table configuration of the module.

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

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
name string Yes No Name of the page to be redirected to.
pageSourceFile string Yes No Path of the page in the module.
buildFunction string Yes No Function decorated by @Builder. The function describes the UI of the page.
data Array<DataItem> Yes No User-defined string in the routing table configuration file, that is, value of the data field. This field is parsed by the system. You do not need to parse it.
customData string Yes No Any type of custom data in the routing table configuration file, that is, JSON string of the customData field. You need to call JSON.parse to parse the field.

DataItem12+

Describes the user-defined data in the routing table configuration of the module.

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

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
key string Yes No Key of the user-defined data.
value string Yes No Value of the user-defined data.

你可能感兴趣的鸿蒙文章

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

0  赞