harmony 鸿蒙BundleInfo

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

BundleInfo

The BundleInfo module defines the bundle information. A third-party application can obtain its own bundle information through bundleManager.getBundleInfoForSelf, with bundleFlags set to the information to be contained in the returned BundleInfo.

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.

BundleInfo

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
name string Yes No Bundle name.
Atomic service API: This API can be used in atomic services since API version 11.
vendor string Yes No Vendor of the bundle.
Atomic service API: This API can be used in atomic services since API version 11.
versionCode number Yes No Version number of the bundle.
Atomic service API: This API can be used in atomic services since API version 11.
versionName string Yes No Version description of the bundle.
Atomic service API: This API can be used in atomic services since API version 11.
minCompatibleVersionCode number Yes No Earliest version compatible with the bundle in the distributed scenario.
Atomic service API: This API can be used in atomic services since API version 11.
targetVersion number Yes No Target runtime version of the bundle.
Atomic service API: This API can be used in atomic services since API version 11.
appInfo ApplicationInfo Yes No Application information. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_APPLICATION to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
hapModulesInfo Array<HapModuleInfo> Yes No Module configuration information. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_HAP_MODULE to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
reqPermissionDetails Array<ReqPermissionDetail> Yes No Detailed information of the permissions to request from the system. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
permissionGrantStates Array<bundleManager.PermissionGrantState> Yes No Permission grant state. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
signatureInfo SignatureInfo Yes No Signature information of the bundle. The information can be obtained by passing in GET_BUNDLE_INFO_WITH_SIGNATURE_INFO to the bundleFlags parameter of getBundleInfoForSelf.
Atomic service API: This API can be used in atomic services since API version 11.
installTime number Yes No Timestamp when the bundle was installed, in milliseconds.
Atomic service API: This API can be used in atomic services since API version 11.
updateTime number Yes No Timestamp when the bundle was last updated, in milliseconds.
Atomic service API: This API can be used in atomic services since API version 11.
routerMap12+ Array<RouterItem> Yes No Router table of the application. The table is obtained by deduplicating and combining the routerMap information under hapModulesInfo based on the name field in RouterItem. 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.
appIndex12+ number Yes No Index of an application clone. It takes effect only for application clones.
firstInstallTime18+ number Yes Yes Timestamp when the bundle was first installed on the current device, in milliseconds.
Atomic service API: This API can be used in atomic services since API version 18.

ReqPermissionDetail

Provides the detailed information of the permissions to request from the system. > NOTE > > If multiple packages of an application have requested the same permission but with different reasons, the system returns only one reason based on a descending priority order: entry HAP > feature HAP > in-app HSP.

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
name string No No Name of the permission to request.
moduleName10+ string No No Name of the module that requests the permission.
reason string No No Reason for requesting the permission.
reasonId number No No ID of the reason for requesting the permission.
usedScene UsedScene No No Use scenario and timing for using the permission.

UsedScene

Describes the use scenario and timing for using the permission.

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
abilities Array<string> No No Abilities that use the permission.
when string No No Time when the permission is used. The value can be inuse or always.

SignatureInfo

Describes the signature information of the bundle.

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
appId string Yes No Application ID.
Atomic service API: This API can be used in atomic services since API version 11.
fingerprint string Yes No Fingerprint information of the bundle. This field changes when the used signing certificate changes.
Atomic service API: This API can be used in atomic services since API version 11.
appIdentifier11+ string Yes No Unique ID of the application. It is the app ID, which is a random string, allocated by AppGallery Connect during the creation of the application. This ID does not change along the application lifecycle, including version updates, certificate changes, public and private key changes, and application transfers. If you use multiple debugging devices, perform debugging offline, or need to interact with other applications, you are advised to use manual signature.
Atomic service API: This API can be used in atomic services since API version 11.
certificate14+ string Yes Yes Public key of the application certificate.
Atomic service API: This API can be used in atomic services since API version 14.

AppCloneIdentity14+

Describes the identity information of an application clone.

System capability: SystemCapability.BundleManager.BundleFramework.Core

Name Type Read-Only Optional Description
bundleName string Yes No Bundle name of the application.
appIndex number Yes No Index of the application clone.

你可能感兴趣的鸿蒙文章

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  赞