1# @ohos.bundle.bundleManager (bundleManager) 2 3The bundleManager module provides APIs for obtaining application information, including [BundleInfo](js-apis-bundleManager-bundleInfo.md), [ApplicationInfo](js-apis-bundleManager-applicationInfo.md), [AbilityInfo](js-apis-bundleManager-abilityInfo.md), and [ExtensionAbility](js-apis-bundleManager-extensionAbilityInfo.md). 4 5> **NOTE** 6> 7> 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. 8 9## Modules to Import 10 11```ts 12import { bundleManager } from '@kit.AbilityKit'; 13``` 14 15## Required Permissions 16 17| Permission | APL | Description | 18| ------------------------------------------ | ------------ | ------------------| 19| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | Permission to obtain basic information and other sensitive information about a bundle.| 20 21For details about the APL, see [Basic Concepts in the Permission Mechanism](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism). 22 23## Enums 24 25### BundleFlag 26 27Enumerates the bundle flags, which indicate the type of bundle information to obtain. 28 29 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 30 31| Name | Value | Description | 32| --------------------------------------------- | ---------- | ------------------------------------------------------------ | 33| GET_BUNDLE_INFO_DEFAULT | 0x00000000 | Used to obtain the default bundle information. The obtained information does not contain information about the signature, application, HAP module, ability, ExtensionAbility, or permission.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 34| GET_BUNDLE_INFO_WITH_APPLICATION | 0x00000001 | Used to obtain the bundle information with application information. The obtained information does not contain information about the signature, HAP module, ability, ExtensionAbility, or permission.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 35| GET_BUNDLE_INFO_WITH_HAP_MODULE | 0x00000002 | Used to obtain the bundle information with HAP module information. The obtained information does not contain information about the signature, application, ability, ExtensionAbility, or permission.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 36| GET_BUNDLE_INFO_WITH_ABILITY | 0x00000004 | Used to obtain the bundle information with ability information. The obtained information does not contain information about the signature, application, ExtensionAbility, or permission. It must be used together with **GET_BUNDLE_INFO_WITH_HAP_MODULE**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 37| GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY | 0x00000008 | Used to obtain the bundle information with ExtensionAbility information. The obtained information does not contain information about the signature, application, ability, or permission. It must be used together with **GET_BUNDLE_INFO_WITH_HAP_MODULE**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 38| GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION | 0x00000010 | Used to obtain the bundle information with permission information. The obtained information does not contain information about the signature, application, HAP module, ability, or ExtensionAbility.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 39| GET_BUNDLE_INFO_WITH_METADATA | 0x00000020 | Used to obtain the metadata contained in the application, HAP module, ability, or ExtensionAbility information. It must be used together with **GET_BUNDLE_INFO_WITH_APPLICATION**, **GET_BUNDLE_INFO_WITH_HAP_MODULE**, **GET_BUNDLE_INFO_WITH_ABILITY**, and **GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 40| GET_BUNDLE_INFO_WITH_DISABLE | 0x00000040 | Used to obtain the information about disabled bundles and abilities of a bundle. The obtained information does not contain information about the signature, application, HAP module, ability, ExtensionAbility, or permission.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 41| GET_BUNDLE_INFO_WITH_SIGNATURE_INFO | 0x00000080 | Used to obtain the bundle information with signature information. The obtained information does not contain information about the application, HAP module, ability, ExtensionAbility, or permission.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 42| GET_BUNDLE_INFO_WITH_MENU<sup>11+</sup> | 0x00000100 | Used to obtain the bundle information with the file context menu configuration. It must be used together with **GET_BUNDLE_INFO_WITH_HAP_MODULE**.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 43| GET_BUNDLE_INFO_WITH_ROUTER_MAP<sup>12+</sup> | 0x00000200 | Used to obtain the bundle information with the router map. It must be used together with **GET_BUNDLE_INFO_WITH_HAP_MODULE**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 44| GET_BUNDLE_INFO_WITH_SKILL<sup>12+</sup> | 0x00000800 | Used to obtain the bundle information with the skills. It must be used together with **GET_BUNDLE_INFO_WITH_HAP_MODULE**, **GET_BUNDLE_INFO_WITH_ABILITY**, and **GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY**.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 45 46### ExtensionAbilityType 47 48Enumerates the types of ExtensionAbilities. 49 50 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 51 52| Name| Value| Description| 53|:----------------:|:---:|-----| 54| FORM | 0 | [FormExtensionAbility](../apis-form-kit/js-apis-app-form-formExtensionAbility.md): provides APIs for widget development.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 55| WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../apis-backgroundtasks-kit/js-apis-WorkSchedulerExtensionAbility.md): enables applications to execute non-real-time tasks when the system is idle.| 56| INPUT_METHOD | 2 | [InputMethodExtensionAbility](../apis-ime-kit/js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.| 57| SERVICE | 3 | <!--Del-->[<!--DelEnd-->ServiceExtensionAbility<!--Del-->](js-apis-app-ability-serviceExtensionAbility-sys.md)<!--DelEnd-->: enables applications to run in the background and provide services.| 58| ACCESSIBILITY | 4 | <!--RP1-->[AccessibilityExtensionAbility](../apis-accessibility-kit/js-apis-application-accessibilityExtensionAbility.md)<!--RP1End-->: provides accessibility for access to and operations on the UI.| 59| DATA_SHARE | 5 | <!--Del-->[<!--DelEnd-->DataShareExtensionAbility <!--Del-->](../apis-arkdata/js-apis-application-dataShareExtensionAbility-sys.md)<!--DelEnd-->: enables applications to read and write data.| 60| FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved and supported only by system applications.| 61| STATIC_SUBSCRIBER| 7 | <!--Del-->[<!--DelEnd-->StaticSubscriberExtensionAbility <!--Del-->](../apis-basic-services-kit/js-apis-application-staticSubscriberExtensionAbility-sys.md)<!--DelEnd-->: provides APIs for processing static events, such as the startup event.| 62| WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved and supported only by system applications.| 63| BACKUP | 9 | [BackupExtensionAbility](../apis-core-file-kit/js-apis-application-backupExtensionAbility.md): provides APIs to implement application data backup and restore.| 64| WINDOW | 10 | <!--Del-->[<!--DelEnd-->WindowExtensionAbility<!--Del-->](../apis-arkui/js-apis-application-windowExtensionAbility-sys.md)<!--DelEnd-->: allows system applications to display UIs of other applications.| 65| ENTERPRISE_ADMIN | 11 | [EnterpriseAdminExtensionAbility](../apis-mdm-kit/js-apis-EnterpriseAdminExtensionAbility.md): provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.| 66| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved and supported only by system applications.| 67| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved and supported only by system applications.| 68| PRINT<sup>10+</sup> | 15 | PrintExtensionAbility: provides APIs for printing images. This ability is supported only by system applications.| 69| SHARE<sup>10+</sup> | 16 | [ShareExtensionAbility](js-apis-app-ability-shareExtensionAbility.md): provides sharing service templates based on UIExtensionAbilities.| 70| PUSH<sup>10+</sup> | 17 | PushExtensionAbility: provides APIs for pushing scenario-specific messages. This ability is reserved and supported only by system applications.| 71| DRIVER<sup>10+</sup> | 18 | [DriverExtensionAbility](../apis-driverdevelopment-kit/js-apis-app-ability-driverExtensionAbility.md): provides APIs for the peripheral driver. This ability is supported only by system applications.| 72| ACTION<sup>10+</sup> | 19 | [ActionExtensionAbility](js-apis-app-ability-actionExtensionAbility.md): provides custom action service templates based on UIExtensionAbilities.| 73| ADS_SERVICE<sup>11+</sup> | 20 | AdsServiceExtensionAbility: provides background customized ad services for external systems. This ability is supported only by system applications.| 74| EMBEDDED_UI<sup>12+</sup> | 21 | [EmbeddedUIExtensionAbility](js-apis-app-ability-embeddedUIExtensionAbility.md): provides ExtensionAbilities for the embeddable UI across process.| 75| INSIGHT_INTENT_UI<sup>12+</sup> | 22 | **InsightIntentUIExtensionAbility**: provides APIs that enable applications to be called by Celia intents so as to be displayed in windows.| 76| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of ExtensionAbilities.| 77 78 79### PermissionGrantState 80 81Enumerates the permission grant states. 82 83 **Atomic service API**: This API can be used in atomic services since API version 11. 84 85 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 86 87| Name| Value| Description| 88|:----------------:|:---:|:---:| 89| PERMISSION_DENIED| -1 | Permission denied.| 90| PERMISSION_GRANTED | 0 | Permission granted. | 91 92### SupportWindowMode 93 94Enumerates the window modes supported by the ability. 95 96 **Atomic service API**: This API can be used in atomic services since API version 11. 97 98 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 99 100| Name| Value| Description| 101|:----------------:|:---:|:---:| 102| FULL_SCREEN | 0 | A window in full-screen mode is supported.| 103| SPLIT | 1 | A window in split-screen mode is supported.| 104| FLOATING | 2 | A floating window is supported. | 105 106### LaunchType 107 108Enumerates the launch types of the ability. 109 110 **Atomic service API**: This API can be used in atomic services since API version 11. 111 112 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 113 114| Name| Value| Description| 115|:----------------:|:---:|:---:| 116| SINGLETON | 0 | The ability can have only one instance.| 117| MULTITON | 1 | The ability can have multiple instances.| 118| SPECIFIED | 2 | The ability can have one or multiple instances, depending on the internal service of the ability.| 119 120### AbilityType 121 122Enumerates the types of abilities. 123 124 **Model restriction**: This API can be used only in the FA model. 125 126 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 127 128| Name | Value | Description | 129| :-----: | ---- | :--------------------------------------------------------: | 130| PAGE | 1 | Ability that has the UI. FA developed using the Page template to provide the capability of interacting with users. | 131| SERVICE | 2 | Ability of the background service type, without the UI. PA developed using the Service template to provide the capability of running tasks in the background. | 132| DATA | 3 | PA developed using the Data template to provide unified data access for external systems.| 133 134### DisplayOrientation 135 136Enumerates the display orientations of the ability. This property applies only to the ability using the Page template. 137 138 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 139 140| Name |Value|Description| 141|:----------------------------------|---|---| 142| UNSPECIFIED |0 |Unspecified. The orientation is determined by the system.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 143| LANDSCAPE |1 |Landscape.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 144| PORTRAIT |2 |Portrait.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 145| FOLLOW_RECENT |3 |The last display orientation is used.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 146| LANDSCAPE_INVERTED |4 |Reverse landscape.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 147| PORTRAIT_INVERTED |5 |Reverse portrait.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 148| AUTO_ROTATION |6 |Auto rotation.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 149| AUTO_ROTATION_LANDSCAPE |7 |Auto rotation in the horizontal direction.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 150| AUTO_ROTATION_PORTRAIT |8 |Auto rotation in the vertical direction.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 151| AUTO_ROTATION_RESTRICTED |9 |Switched-determined auto rotation.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 152| AUTO_ROTATION_LANDSCAPE_RESTRICTED |10|Switched-determined auto rotation in the horizontal direction.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 153| AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 154| LOCKED |12|Locked.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| 155| AUTO_ROTATION_UNSPECIFIED<sup>12+</sup> |13|Auto rotation controlled by the switch and determined by the system.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 156| FOLLOW_DESKTOP<sup>12+</sup> |14|Following the orientation of the home screen.<br>**Atomic service API**: This API can be used in atomic services since API version 12.| 157 158### CompatiblePolicy<sup>10+</sup> 159 160Defines the version compatibility type of the shared library. 161 162 **Atomic service API**: This API can be used in atomic services since API version 11. 163 164 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 165 166| Name | Value | Description | 167| ---------------------- | ---- | -------------------------------- | 168| BACKWARD_COMPATIBILITY | 1 | The shared library is backward compatible.| 169 170### ModuleType 171 172Enumerates the module types. 173 174 **Atomic service API**: This API can be used in atomic services since API version 11. 175 176 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 177 178| Name | Value | Description | 179| ------- | ---- | -------------------- | 180| ENTRY | 1 | Main module of the application. | 181| FEATURE | 2 | Dynamic feature module of the application.| 182| SHARED | 3 | Dynamic shared library module of the application. | 183 184### BundleType 185 186Enumerates the bundle types. 187 188 **Atomic service API**: This API can be used in atomic services since API version 11. 189 190 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 191 192| Name | Value | Description | 193| -------------- | ---- | --------------- | 194| APP | 0 | The bundle is an application. | 195| ATOMIC_SERVICE | 1 | The bundle is an atomic service.| 196 197### MultiAppModeType<sup>12+</sup> 198Enumerates the types of the multi-app mode. 199 200 **System capability**: SystemCapability.BundleManager.BundleFramework.Core 201 202| Name| Value| Description| 203|:----------------:|:---:|:---:| 204| UNSPECIFIED| 0 | Unspecified type.| 205| MULTI_INSTANCE | 1 | Multiton mode. A resident process does not support this value. | 206| APP_CLONE | 2 | App clone mode. | 207 208## APIs 209 210### bundleManager.getBundleInfoForSelf 211 212getBundleInfoForSelf(bundleFlags: number): Promise\<BundleInfo> 213 214Obtains the bundle information based on the given bundle flags. This API uses a promise to return the result. 215 216**Atomic service API**: This API can be used in atomic services since API version 11. 217 218**System capability**: SystemCapability.BundleManager.BundleFramework.Core 219 220**Parameters** 221 222| Name | Type | Mandatory| Description | 223| ----------- | ------ | ---- | --------------------- | 224| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 225 226**Return value** 227 228| Type | Description | 229| ----------------------------------------------------------- | ------------------------------------- | 230| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise used to return the bundle information.| 231 232**Error codes** 233 234For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 235 236| ID| Error Message | 237| -------- | ------------------------------------------------------------ | 238| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 239 240**Example** 241 242```ts 243// Obtain application info with metadataArray. 244import { bundleManager } from '@kit.AbilityKit'; 245import { BusinessError } from '@kit.BasicServicesKit'; 246import { hilog } from '@kit.PerformanceAnalysisKit'; 247 248let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA; 249 250try { 251 bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => { 252 hilog.info(0x0000, 'testTag', 'getBundleInfoForSelf successfully. Data: %{public}s', JSON.stringify(data)); 253 }).catch((err: BusinessError) => { 254 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed. Cause: %{public}s', err.message); 255 }); 256} catch (err) { 257 let message = (err as BusinessError).message; 258 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', message); 259} 260``` 261 262### bundleManager.getBundleInfoForSelf 263 264getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void 265 266Obtains the bundle information based on the given bundle flags. This API uses an asynchronous callback to return the result. 267 268**Atomic service API**: This API can be used in atomic services since API version 11. 269 270**System capability**: SystemCapability.BundleManager.BundleFramework.Core 271 272**Parameters** 273 274| Name | Type | Mandatory| Description | 275| ----------- | ------ | ---- | --------------------- | 276| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 277| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Yes| Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle information obtained. Otherwise, **err** is an error object.| 278 279**Error codes** 280 281For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 282 283| ID| Error Message | 284| -------- | ------------------------------------------------------------ | 285| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 286 287**Example** 288 289```ts 290// Obtain ability info with permissions. 291import { bundleManager } from '@kit.AbilityKit'; 292import { BusinessError } from '@kit.BasicServicesKit'; 293import { hilog } from '@kit.PerformanceAnalysisKit'; 294 295let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; 296 297try { 298 bundleManager.getBundleInfoForSelf(bundleFlags, (err, data) => { 299 if (err) { 300 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', err.message); 301 } else { 302 hilog.info(0x0000, 'testTag', 'getBundleInfoForSelf successfully: %{public}s', JSON.stringify(data)); 303 } 304 }); 305} catch (err) { 306 let message = (err as BusinessError).message; 307 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelf failed: %{public}s', message); 308} 309``` 310 311### bundleManager.getProfileByAbility 312 313getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void 314 315Obtains the JSON string array of the configuration file based on the given module name, ability name, and metadata name (name configured in [metadata](../../quick-start/module-configuration-file.md#metadata)). This API uses an asynchronous callback to return the result. 316 317> **NOTE** 318> 319> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 320 321**Atomic service API**: This API can be used in atomic services since API version 11. 322 323**System capability**: SystemCapability.BundleManager.BundleFramework.Core 324 325**Parameters** 326 327| Name | Type | Mandatory| Description | 328| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | 329| moduleName | string | Yes | Module name. | 330| abilityName | string | Yes | Name of the UIAbility component. | 331| metadataName | string | Yes | Metadata name of the UIAbility component, that is, **name** of the **metadata** tag under **abilities** in the **module.json5** file. | 332| callback | AsyncCallback<Array\<string>> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of JSON strings obtained. Otherwise, **err** is an error object.| 333 334**Error codes** 335 336For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 337 338| ID| Error Message | 339| -------- | ------------------------------------------------------------ | 340| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 341| 17700002 | The specified moduleName is not existed. | 342| 17700003 | The specified abilityName is not existed. | 343| 17700024 | Failed to get the profile because there is no profile in the HAP. | 344| 17700026 | The specified bundle is disabled. | 345| 17700029 | The specified ability is disabled. | 346 347**Example** 348 349```ts 350import { bundleManager } from '@kit.AbilityKit'; 351import { BusinessError } from '@kit.BasicServicesKit'; 352import { hilog } from '@kit.PerformanceAnalysisKit'; 353 354let moduleName = 'entry'; 355let abilityName = 'EntryAbility'; 356let metadataName = 'ability_metadata'; 357 358try { 359 bundleManager.getProfileByAbility(moduleName, abilityName, metadataName, (err, data) => { 360 if (err) { 361 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', err.message); 362 } else { 363 hilog.info(0x0000, 'testTag', 'getProfileByAbility successfully: %{public}s', JSON.stringify(data)); 364 } 365 }); 366} catch (err) { 367 let message = (err as BusinessError).message; 368 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', message); 369} 370``` 371 372### bundleManager.getProfileByAbility 373 374getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string\>\> 375 376Obtains the JSON string array of the configuration file based on the given module name, ability name, and metadata name (name configured in [metadata](../../quick-start/module-configuration-file.md#metadata)). This API uses a promise to return the result. 377 378> **NOTE** 379> 380> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 381 382**Atomic service API**: This API can be used in atomic services since API version 11. 383 384**System capability**: SystemCapability.BundleManager.BundleFramework.Core 385 386**Parameters** 387 388| Name | Type | Mandatory| Description | 389| ------------ | ------ | ---- | -------------------------- | 390| moduleName | string | Yes | Module name. | 391| abilityName | string | Yes | Name of the UIAbility component. | 392| metadataName | string | No | Metadata name of the UIAbility component, that is, **name** of the **metadata** tag under **abilities** in the **module.json5** file. The default value is null.| 393 394**Return value** 395 396| Type | Description | 397| ----------------------- | ------------------------------- | 398| Promise<Array\<string>> | Promise used to return the array of JSON strings obtained.| 399 400**Error codes** 401 402For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 403 404| ID| Error Message | 405| -------- | ------------------------------------------------------------ | 406| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 407| 17700002 | The specified moduleName is not existed. | 408| 17700003 | The specified abilityName is not existed. | 409| 17700024 | Failed to get the profile because there is no profile in the HAP. | 410| 17700026 | The specified bundle is disabled. | 411| 17700029 | The specified ability is disabled. | 412 413**Example** 414 415```ts 416import { bundleManager } from '@kit.AbilityKit'; 417import { BusinessError } from '@kit.BasicServicesKit'; 418import { hilog } from '@kit.PerformanceAnalysisKit'; 419 420let moduleName = 'entry'; 421let abilityName = 'EntryAbility'; 422 423try { 424 // Obtain the JSON string array of the configuration file based on the module name and ability name. 425 bundleManager.getProfileByAbility(moduleName, abilityName).then((data) => { 426 hilog.info(0x0000, 'testTag', 'getProfileByAbility successfully. Data: %{public}s', JSON.stringify(data)); 427 }).catch((err: BusinessError) => { 428 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', err.message); 429 }); 430} catch (err) { 431 let message = (err as BusinessError).message; 432 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', message); 433} 434``` 435 436```ts 437import { bundleManager } from '@kit.AbilityKit'; 438import { BusinessError } from '@kit.BasicServicesKit'; 439import { hilog } from '@kit.PerformanceAnalysisKit'; 440 441let moduleName = 'entry'; 442let abilityName = 'EntryAbility'; 443let metadataName = 'ability_metadata'; 444 445try { 446 // Obtain the JSON string array of the configuration file based on the module name, ability name, and metadata name. 447 bundleManager.getProfileByAbility(moduleName, abilityName, metadataName).then((data) => { 448 hilog.info(0x0000, 'testTag', 'getProfileByAbility successfully. Data: %{public}s', JSON.stringify(data)); 449 }).catch((err: BusinessError) => { 450 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', err.message); 451 }); 452} catch (err) { 453 let message = (err as BusinessError).message; 454 hilog.error(0x0000, 'testTag', 'getProfileByAbility failed. Cause: %{public}s', message); 455} 456``` 457 458### bundleManager.getProfileByAbilitySync<sup>10+</sup> 459 460getProfileByAbilitySync(moduleName: string, abilityName: string, metadataName?: string): Array\<string\> 461 462Obtains the JSON string array of the current application's configuration file in the [metadata](../../quick-start/module-configuration-file.md#metadata) based on a given module name, ability name, and metadata name. This API returns the result synchronously. The result value is a string array. 463 464> **NOTE** 465> 466> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 467 468**Atomic service API**: This API can be used in atomic services since API version 11. 469 470**System capability**: SystemCapability.BundleManager.BundleFramework.Core 471 472**Parameters** 473 474| Name | Type | Mandatory| Description | 475| ------------ | ------ | ---- | -------------------------- | 476| moduleName | string | Yes | Module name. | 477| abilityName | string | Yes | Name of the UIAbility component. | 478| metadataName | string | No | Metadata name of the UIAbility component, that is, **name** of the **metadata** tag under **abilities** in the **module.json5** file. The default value is null.| 479 480**Return value** 481 482| Type | Description | 483| ----------------------- | ------------------------------- | 484| Array\<string> | An array of JSON strings.| 485 486**Error codes** 487 488For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 489 490| ID| Error Message | 491| -------- | ------------------------------------------------------------ | 492| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 493| 17700002 | The specified moduleName is not existed. | 494| 17700003 | The specified abilityName is not existed. | 495| 17700024 | Failed to get the profile because there is no profile in the HAP. | 496| 17700026 | The specified bundle is disabled. | 497| 17700029 | The specified ability is disabled. | 498 499**Example** 500 501```ts 502import { bundleManager } from '@kit.AbilityKit'; 503import { BusinessError } from '@kit.BasicServicesKit'; 504import { hilog } from '@kit.PerformanceAnalysisKit'; 505 506let moduleName = 'entry'; 507let abilityName = 'EntryAbility'; 508 509try { 510 // Obtain the JSON string array of the configuration file based on the module name and ability name. 511 let data = bundleManager.getProfileByAbilitySync(moduleName, abilityName); 512 hilog.info(0x0000, 'testTag', 'getProfileByAbilitySync successfully. Data: %{public}s', JSON.stringify(data)); 513} catch (err) { 514 let message = (err as BusinessError).message; 515 hilog.error(0x0000, 'testTag', 'getProfileByAbilitySync failed. Cause: %{public}s', message); 516} 517``` 518 519```ts 520import { bundleManager } from '@kit.AbilityKit'; 521import { BusinessError } from '@kit.BasicServicesKit'; 522import { hilog } from '@kit.PerformanceAnalysisKit'; 523 524let moduleName: string = 'entry'; 525let abilityName: string = 'EntryAbility'; 526let metadataName: string = 'ability_metadata'; 527 528try { 529 // Obtain the JSON string array of the configuration file based on the module name, ability name, and metadata name. 530 let data = bundleManager.getProfileByAbilitySync(moduleName, abilityName, metadataName); 531 hilog.info(0x0000, 'testTag', 'getProfileByAbilitySync successfully. Data: %{public}s', JSON.stringify(data)); 532} catch (err) { 533 let message = (err as BusinessError).message; 534 hilog.error(0x0000, 'testTag', 'getProfileByAbilitySync failed. Cause: %{public}s', message); 535} 536``` 537 538### bundleManager.getProfileByExtensionAbility 539 540getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string\>\>): void 541 542Obtains the JSON string array of the configuration file based on the given module name, ExtensionAbility name, and metadata name (name configured in [metadata](../../quick-start/module-configuration-file.md#metadata)). This API uses an asynchronous callback to return the result. 543 544> **NOTE** 545> 546> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 547 548**Atomic service API**: This API can be used in atomic services since API version 11. 549 550**System capability**: SystemCapability.BundleManager.BundleFramework.Core 551 552**Parameters** 553 554| Name | Type | Mandatory| Description | 555| -------------------- | ----------------------------- | ---- | ------------------------------------------------------------ | 556| moduleName | string | Yes | Module name. | 557| extensionAbilityName | string | Yes | Name of the ExtensionAbility component. | 558| metadataName | string | Yes | Metadata name of the ExtensionAbility component, that is, **name** of the **metadata** tag under **extensionAbilities** in the **module.json5** file. | 559| callback | AsyncCallback<Array\<string>> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of JSON strings obtained. Otherwise, **err** is an error object.| 560 561**Error codes** 562 563For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 564 565| ID| Error Message | 566| -------- | ------------------------------------------------------------ | 567| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 568| 17700002 | The specified moduleName is not existed. | 569| 17700003 | The specified extensionAbilityName not existed. | 570| 17700024 | Failed to get the profile because there is no profile in the HAP. | 571| 17700026 | The specified bundle is disabled. | 572 573**Example** 574 575```ts 576import { bundleManager } from '@kit.AbilityKit'; 577import { BusinessError } from '@kit.BasicServicesKit'; 578import { hilog } from '@kit.PerformanceAnalysisKit'; 579 580let moduleName = 'entry'; 581let extensionAbilityName = 'com.example.myapplication.extension'; 582let metadataName = 'ability_metadata'; 583 584try { 585 bundleManager.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName, (err, data) => { 586 if (err) { 587 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed: %{public}s', err.message); 588 } else { 589 hilog.info(0x0000, 'testTag', 'getProfileByExtensionAbility successfully: %{public}s', JSON.stringify(data)); 590 } 591 }); 592} catch (err) { 593 let message = (err as BusinessError).message; 594 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed: %{public}s', message); 595} 596``` 597 598### bundleManager.getProfileByExtensionAbility 599 600getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string\>\> 601 602Obtains the JSON string array of the current application's configuration file in the [metadata](../../quick-start/module-configuration-file.md#metadata) based on a given module name, ExtensionAbility name, and metadata name. This API uses a promise to return the result. 603 604> **NOTE** 605> 606> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 607 608**Atomic service API**: This API can be used in atomic services since API version 11. 609 610**System capability**: SystemCapability.BundleManager.BundleFramework.Core 611 612**Parameters** 613 614| Name | Type | Mandatory| Description | 615| -------------------- | ------ | ---- | ---------------------------------- | 616| moduleName | string | Yes | Module name. | 617| extensionAbilityName | string | Yes | Name of the ExtensionAbility component.| 618| metadataName | string | No | Metadata name of the ExtensionAbility component, that is, **name** of the **metadata** tag under **extensionAbilities** in the **module.json5** file. The default value is null. | 619 620**Return value** 621 622| Type | Description | 623| ----------------------- | ----------------------------------- | 624| Promise<Array\<string>> | Promise used to return the array of JSON strings obtained.| 625 626**Error codes** 627 628For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 629 630| ID| Error Message | 631| -------- | ------------------------------------------------------------ | 632| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 633| 17700002 | The specified moduleName is not existed. | 634| 17700003 | The specified extensionAbilityName not existed. | 635| 17700024 | Failed to get the profile because there is no profile in the HAP. | 636| 17700026 | The specified bundle is disabled. | 637 638**Example** 639 640```ts 641import { bundleManager } from '@kit.AbilityKit'; 642import { BusinessError } from '@kit.BasicServicesKit'; 643import { hilog } from '@kit.PerformanceAnalysisKit'; 644 645let moduleName = 'entry'; 646let extensionAbilityName = 'com.example.myapplication.extension'; 647let metadataName = 'ability_metadata'; 648 649try { 650 bundleManager.getProfileByExtensionAbility(moduleName, extensionAbilityName).then((data) => { 651 hilog.info(0x0000, 'testTag', 'getProfileByExtensionAbility successfully. Data: %{public}s', JSON.stringify(data)); 652 }).catch((err: BusinessError) => { 653 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed. Cause: %{public}s', err.message); 654 }); 655} catch (err) { 656 let message = (err as BusinessError).message; 657 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed. Cause: %{public}s', message); 658} 659 660try { 661 bundleManager.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataName).then((data) => { 662 hilog.info(0x0000, 'testTag', 'getProfileByExtensionAbility successfully. Data: %{public}s', JSON.stringify(data)); 663 }).catch((err: BusinessError) => { 664 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed. Cause: %{public}s', err.message); 665 }); 666} catch (err) { 667 let message = (err as BusinessError).message; 668 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbility failed. Cause: %{public}s', message); 669} 670``` 671 672### bundleManager.getProfileByExtensionAbilitySync<sup>10+</sup> 673 674getProfileByExtensionAbilitySync(moduleName: string, extensionAbilityName: string, metadataName?: string): Array\<string\> 675 676Obtains the JSON string array of the current application's configuration file in the [metadata](../../quick-start/module-configuration-file.md#metadata) based on a given module name, ExtensionAbility name, and metadata name. This API returns the result synchronously. The result value is a string array. 677 678> **NOTE** 679> 680> If the profile uses the resource reference format, the return value retains this format (for example, **$string:res_id**). You can obtain the referenced resources through related APIs of the resource management module. 681 682**Atomic service API**: This API can be used in atomic services since API version 11. 683 684**System capability**: SystemCapability.BundleManager.BundleFramework.Core 685 686**Parameters** 687 688| Name | Type | Mandatory| Description | 689| -------------------- | ------ | ---- | ---------------------------------- | 690| moduleName | string | Yes | Module name. | 691| extensionAbilityName | string | Yes | Name of the ExtensionAbility component.| 692| metadataName | string | No | Metadata name of the ExtensionAbility component, that is, **name** of the **metadata** tag under **extensionAbilities** in the **module.json5** file. The default value is null. | 693 694**Return value** 695 696| Type | Description | 697| ----------------------- | ----------------------------------- | 698| Array\<string> | An array of JSON strings.| 699 700**Error codes** 701 702For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 703 704| ID| Error Message | 705| -------- | ------------------------------------------------------------ | 706| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 707| 17700002 | The specified moduleName is not existed. | 708| 17700003 | The specified extensionAbilityName not existed. | 709| 17700024 | Failed to get the profile because there is no profile in the HAP. | 710| 17700026 | The specified bundle is disabled. | 711 712**Example** 713 714```ts 715import { bundleManager } from '@kit.AbilityKit'; 716import { BusinessError } from '@kit.BasicServicesKit'; 717import { hilog } from '@kit.PerformanceAnalysisKit'; 718 719let moduleName = 'entry'; 720let extensionAbilityName = 'com.example.myapplication.extension'; 721let metadataName = 'ability_metadata'; 722 723try { 724 let data = bundleManager.getProfileByExtensionAbilitySync(moduleName, extensionAbilityName); 725 hilog.info(0x0000, 'testTag', 'getProfileByExtensionAbilitySync successfully. Data: %{public}s', JSON.stringify(data)); 726} catch (err) { 727 let message = (err as BusinessError).message; 728 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbilitySync failed. Cause: %{public}s', message); 729} 730 731try { 732 let data = bundleManager.getProfileByExtensionAbilitySync(moduleName, extensionAbilityName, metadataName); 733 hilog.info(0x0000, 'testTag', 'getProfileByExtensionAbilitySync successfully. Data: %{public}s', JSON.stringify(data)); 734} catch (err) { 735 let message = (err as BusinessError).message; 736 hilog.error(0x0000, 'testTag', 'getProfileByExtensionAbilitySync failed. Cause: %{public}s', message); 737} 738``` 739 740### bundleManager.getBundleInfoForSelfSync<sup>10+</sup> 741 742getBundleInfoForSelfSync(bundleFlags: number): BundleInfo 743 744Obtains the bundle information of this bundle based on the given bundle flags. This API returns the result synchronously. 745 746**Atomic service API**: This API can be used in atomic services since API version 11. 747 748**System capability**: SystemCapability.BundleManager.BundleFramework.Core 749 750**Parameters** 751 752| Name | Type | Mandatory| Description | 753| ----------- | ------ | ---- | --------------------- | 754| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 755 756**Return value** 757 758| Type | Description | 759| ------------------------------------------------- | -------------------- | 760| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.| 761 762**Error codes** 763 764For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 765 766| ID| Error Message | 767| -------- | ------------------------------------------------------------ | 768| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 769 770**Example** 771 772```ts 773import { bundleManager } from '@kit.AbilityKit'; 774import { BusinessError } from '@kit.BasicServicesKit'; 775import { hilog } from '@kit.PerformanceAnalysisKit'; 776 777let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; 778 779try { 780 let data = bundleManager.getBundleInfoForSelfSync(bundleFlags); 781 hilog.info(0x0000, 'testTag', 'getBundleInfoForSelfSync successfully: %{public}s', JSON.stringify(data)); 782} catch (err) { 783 let message = (err as BusinessError).message; 784 hilog.error(0x0000, 'testTag', 'getBundleInfoForSelfSync failed: %{public}s', message); 785} 786``` 787 788### bundleManager.canOpenLink<sup>12+</sup> 789 790canOpenLink(link: string): boolean 791 792Checks whether a link can be opened. The scheme of the specified link must be configured in the **querySchemes** field of the **module.json** file. 793 794**Atomic service API**: This API can be used in atomic services since API version 12. 795 796**System capability**: SystemCapability.BundleManager.BundleFramework.Core 797 798**Parameters** 799 800| Name | Type | Mandatory| Description | 801| ----------- | ------ | ---- | --------------------- | 802| link | string | Yes | Link to check.| 803 804**Return value** 805 806| Type | Description | 807| ------------------------------------------------- | -------------------- | 808| boolean | **true**: The link can be opened.<br>**false**: The link cannot be opened.| 809 810**Error codes** 811 812For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 813 814| ID| Error Message | 815| -------- | ------------------------------------------------------------ | 816| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 817| 17700055 | The specified link is invalid. | 818| 17700056 | The scheme of the specified link is not in the querySchemes. | 819 820**Example** 821 822```ts 823import { bundleManager } from '@kit.AbilityKit'; 824import { BusinessError } from '@kit.BasicServicesKit'; 825import { hilog } from '@kit.PerformanceAnalysisKit'; 826 827try { 828 let link = 'welink://'; 829 let data = bundleManager.canOpenLink(link); 830 hilog.info(0x0000, 'testTag', 'canOpenLink successfully: %{public}s', JSON.stringify(data)); 831} catch (err) { 832 let message = (err as BusinessError).message; 833 hilog.error(0x0000, 'testTag', 'canOpenLink failed: %{public}s', message); 834} 835``` 836 837### bundleManager.getLaunchWant<sup>13+</sup> 838 839getLaunchWant(): Want 840 841Obtains the **Want** parameter used to start the application. 842 843**Atomic service API**: This API can be used in atomic services since API version 13. 844 845**System capability**: SystemCapability.BundleManager.BundleFramework.Core 846 847**Return value** 848 849| Type | Description | 850| ----------------------------------- | ------------------------------------------- | 851| [Want](js-apis-app-ability-want.md) | Want object that contains the bundle name and ability name.| 852 853**Error codes** 854 855For details about the error codes, see [Bundle Error Codes](errorcode-bundle.md). 856 857| ID| Error Message | 858| -------- | ----------------------------- | 859| 17700072 | The launch want is not found. | 860 861**Example** 862 863```ts 864import { BusinessError } from '@kit.BasicServicesKit'; 865import { bundleManager } from '@kit.AbilityKit'; 866import { hilog } from '@kit.PerformanceAnalysisKit'; 867 868try { 869 let want = bundleManager.getLaunchWant(); 870 hilog.info(0x0000, 'testTag', 'getLaunchWant ability name: %{public}s', want.abilityName); 871 hilog.info(0x0000, 'testTag', 'getLaunchWant bundle name: %{public}s', want.bundleName); 872} catch (error) { 873 let message = (error as BusinessError).message; 874 hilog.error(0x0000, 'testTag', 'getLaunchWant failed: %{public}s', message); 875} 876``` 877 878### bundleManager.getBundleInfo<sup>14+</sup> 879 880getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<BundleInfo>): void 881 882Obtains the bundle information based on the given bundle name, bundle flags, and user ID. This API uses an asynchronous callback to return the result. 883 884No permission is required for obtaining the caller's own information. 885 886**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 887 888**System capability**: SystemCapability.BundleManager.BundleFramework.Core 889 890**Parameters** 891 892| Name | Type | Mandatory| Description | 893| ----------- | ------ | ---- | ---------------------------- | 894| bundleName | string | Yes | Bundle name.| 895| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 896| userId | number | Yes | User ID. | 897| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Yes| Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle information obtained. Otherwise, **err** is an error object.| 898 899**Error codes** 900 901For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 902 903| ID| Error Message | 904| -------- | ------------------------------------- | 905| 201 | Permission denied. | 906| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 907| 17700001 | The specified bundleName is not found. | 908| 17700004 | The specified user ID is not found. | 909| 17700026 | The specified bundle is disabled. | 910 911**Example** 912 913```ts 914// Obtain the bundle information with the ability information. 915import { bundleManager } from '@kit.AbilityKit'; 916import { BusinessError } from '@kit.BasicServicesKit'; 917import { hilog } from '@kit.PerformanceAnalysisKit'; 918let bundleName = 'com.example.myapplication'; 919let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_ABILITY; 920let userId = 100; 921 922try { 923 bundleManager.getBundleInfo(bundleName, bundleFlags, userId, (err, data) => { 924 if (err) { 925 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', err.message); 926 } else { 927 hilog.info(0x0000, 'testTag', 'getBundleInfo successfully: %{public}s', JSON.stringify(data)); 928 } 929 }); 930} catch (err) { 931 let message = (err as BusinessError).message; 932 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', message); 933} 934``` 935 936```ts 937// Obtain the bundle information with the metadata in the application information. 938import { bundleManager } from '@kit.AbilityKit'; 939import { BusinessError } from '@kit.BasicServicesKit'; 940import { hilog } from '@kit.PerformanceAnalysisKit'; 941let bundleName = 'com.example.myapplication'; 942let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_METADATA; 943let userId = 100; 944 945try { 946 bundleManager.getBundleInfo(bundleName, bundleFlags, userId, (err, data) => { 947 if (err) { 948 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', err.message); 949 } else { 950 hilog.info(0x0000, 'testTag', 'getBundleInfo successfully: %{public}s', JSON.stringify(data)); 951 } 952 }); 953} catch (err) { 954 let message = (err as BusinessError).message; 955 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', message); 956} 957``` 958 959### bundleManager.getBundleInfo<sup>14+</sup> 960 961getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void 962 963Obtains the bundle information based on the given bundle name and bundle flags. This API uses an asynchronous callback to return the result. 964 965No permission is required for obtaining the caller's own information. 966 967**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 968 969**System capability**: SystemCapability.BundleManager.BundleFramework.Core 970 971**Parameters** 972 973| Name | Type | Mandatory| Description | 974| ----------- | ------ | ---- | ---------------------------- | 975| bundleName | string | Yes | Bundle name.| 976| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 977| callback | AsyncCallback\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Yes| Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle information obtained. Otherwise, **err** is an error object.| 978 979**Error codes** 980 981For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 982 983| ID| Error Message | 984| -------- | ------------------------------------- | 985| 201 | Permission denied. | 986| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 987| 17700001 | The specified bundleName is not found. | 988| 17700026 | The specified bundle is disabled. | 989 990**Example** 991 992```ts 993// Obtain the bundle information with the ExtensionAbility information. 994import { bundleManager } from '@kit.AbilityKit'; 995import { BusinessError } from '@kit.BasicServicesKit'; 996import { hilog } from '@kit.PerformanceAnalysisKit'; 997let bundleName = 'com.example.myapplication'; 998let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_HAP_MODULE | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY; 999 1000try { 1001 bundleManager.getBundleInfo(bundleName, bundleFlags, (err, data) => { 1002 if (err) { 1003 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', err.message); 1004 } else { 1005 hilog.info(0x0000, 'testTag', 'getBundleInfo successfully: %{public}s', JSON.stringify(data)); 1006 } 1007 }); 1008} catch (err) { 1009 let message = (err as BusinessError).message; 1010 hilog.error(0x0000, 'testTag', 'getBundleInfo failed: %{public}s', message); 1011} 1012``` 1013 1014### bundleManager.getBundleInfo<sup>14+</sup> 1015 1016getBundleInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<BundleInfo> 1017 1018Obtains the bundle information based on the given bundle name, bundle flags, and user ID. This API uses a promise to return the result. 1019 1020No permission is required for obtaining the caller's own information. 1021 1022**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1023 1024**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1025 1026**Parameters** 1027 1028| Name | Type | Mandatory| Description | 1029| ----------- | ------ | ---- | ---------------------------- | 1030| bundleName | string | Yes | Bundle name.| 1031| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain. | 1032| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. | 1033 1034**Return value** 1035 1036| Type | Description | 1037| ----------------------------------------------------------- | --------------------------- | 1038| Promise\<[BundleInfo](js-apis-bundleManager-bundleInfo.md)> | Promise used to return the bundle information obtained.| 1039 1040**Error codes** 1041 1042For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1043 1044| ID| Error Message | 1045| -------- | --------------------------------------| 1046| 201 | Permission denied. | 1047| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1048| 17700001 | The specified bundleName is not found. | 1049| 17700004 | The specified user ID is not found. | 1050| 17700026 | The specified bundle is disabled. | 1051 1052**Example** 1053 1054```ts 1055// Obtain the bundle information with the application and signature information. 1056import { bundleManager } from '@kit.AbilityKit'; 1057import { BusinessError } from '@kit.BasicServicesKit'; 1058import { hilog } from '@kit.PerformanceAnalysisKit'; 1059let bundleName = 'com.example.myapplication'; 1060let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION | bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_SIGNATURE_INFO; 1061let userId = 100; 1062 1063try { 1064 bundleManager.getBundleInfo(bundleName, bundleFlags, userId).then((data) => { 1065 hilog.info(0x0000, 'testTag', 'getBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); 1066 }).catch((err: BusinessError) => { 1067 hilog.error(0x0000, 'testTag', 'getBundleInfo failed. Cause: %{public}s', err.message); 1068 }); 1069} catch (err) { 1070 let message = (err as BusinessError).message; 1071 hilog.error(0x0000, 'testTag', 'getBundleInfo failed. Cause: %{public}s', message); 1072} 1073``` 1074 1075```ts 1076import { bundleManager } from '@kit.AbilityKit'; 1077import { BusinessError } from '@kit.BasicServicesKit'; 1078import { hilog } from '@kit.PerformanceAnalysisKit'; 1079let bundleName = 'com.example.myapplication'; 1080let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; 1081 1082try { 1083 bundleManager.getBundleInfo(bundleName, bundleFlags).then((data) => { 1084 hilog.info(0x0000, 'testTag', 'getBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); 1085 }).catch((err: BusinessError) => { 1086 hilog.error(0x0000, 'testTag', 'getBundleInfo failed. Cause: %{public}s', err.message); 1087 }); 1088} catch (err) { 1089 let message = (err as BusinessError).message; 1090 hilog.error(0x0000, 'testTag', 'getBundleInfo failed. Cause: %{public}s', message); 1091} 1092 1093``` 1094 1095### bundleManager.getBundleInfoSync<sup>14+</sup> 1096 1097getBundleInfoSync(bundleName: string, bundleFlags: number, userId: number): BundleInfo 1098 1099Obtains the bundle information based on the given bundle name, bundle flags, and user ID. This API returns the result synchronously. 1100 1101No permission is required for obtaining the caller's own information. 1102 1103**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1104 1105**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1106 1107**Parameters** 1108 1109| Name | Type | Mandatory| Description | 1110| ----------- | ------ | ---- | -------------------------------------------------------- | 1111| bundleName | string | Yes | Bundle name. | 1112| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 1113| userId | number | Yes | User ID. | 1114 1115**Return value** 1116 1117| Type | Description | 1118| ---------- | -------------------- | 1119| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.| 1120 1121**Error codes** 1122 1123For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1124 1125| ID| Error Message | 1126| -------- | ------------------------------------- | 1127| 201 | Permission denied. | 1128| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1129| 17700001 | The specified bundleName is not found. | 1130| 17700004 | The specified user ID is not found. | 1131| 17700026 | The specified bundle is disabled. | 1132 1133**Example** 1134 1135```ts 1136import { bundleManager } from '@kit.AbilityKit'; 1137import { BusinessError } from '@kit.BasicServicesKit'; 1138import { hilog } from '@kit.PerformanceAnalysisKit'; 1139let bundleName = 'com.example.myapplication'; 1140let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; 1141let userId = 100; 1142 1143try { 1144 let data = bundleManager.getBundleInfoSync(bundleName, bundleFlags, userId); 1145 hilog.info(0x0000, 'testTag', 'getBundleInfoSync successfully: %{public}s', JSON.stringify(data)); 1146} catch (err) { 1147 let message = (err as BusinessError).message; 1148 hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', message); 1149} 1150``` 1151 1152### bundleManager.getBundleInfoSync<sup>14+</sup> 1153 1154getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo 1155 1156Obtains the bundle information based on the given bundle name and bundle flags. This API returns the result synchronously. 1157 1158No permission is required for obtaining the caller's own information. 1159 1160**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1161 1162**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1163 1164**Parameters** 1165 1166| Name | Type | Mandatory| Description | 1167| ----------- | --------------------- | ---- | ------------------------------------------------------ | 1168| bundleName | string | Yes | Bundle name. | 1169| [bundleFlags](js-apis-bundleManager.md#bundleflag) | number | Yes | Type of the bundle information to obtain.| 1170 1171**Return value** 1172 1173| Type | Description | 1174| ------------------------------------------------- | -------------------- | 1175| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.| 1176 1177**Error codes** 1178 1179For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1180 1181| ID| Error Message | 1182| -------- | -------------------------------------- | 1183| 201 | Permission denied. | 1184| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1185| 17700001 | The specified bundleName is not found. | 1186| 17700026 | The specified bundle is disabled. | 1187 1188**Example** 1189 1190```ts 1191import { bundleManager } from '@kit.AbilityKit'; 1192import { BusinessError } from '@kit.BasicServicesKit'; 1193import { hilog } from '@kit.PerformanceAnalysisKit'; 1194let bundleName = 'com.example.myapplication'; 1195let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; 1196try { 1197 let data = bundleManager.getBundleInfoSync(bundleName, bundleFlags); 1198 hilog.info(0x0000, 'testTag', 'getBundleInfoSync successfully: %{public}s', JSON.stringify(data)); 1199} catch (err) { 1200 let message = (err as BusinessError).message; 1201 hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', message); 1202} 1203``` 1204 1205### bundleManager.getBundleNameByUid<sup>14+</sup> 1206 1207getBundleNameByUid(uid: number, callback: AsyncCallback\<string>): void 1208 1209Obtains the bundle name based on the given UID. This API uses an asynchronous callback to return the result. 1210 1211**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1212 1213**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1214 1215**Parameters** 1216 1217| Name | Type | Mandatory| Description | 1218| -------- | ---------------------- | ---- | ------------------------------------------------------------ | 1219| uid | number | Yes | UID of the application. | 1220| callback | AsyncCallback\<string> | Yes | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the bundle name obtained. Otherwise, **err** is an error object.| 1221 1222**Error codes** 1223 1224For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1225 1226| ID| Error Message | 1227| -------- | --------------------- | 1228| 201 | Permission denied. | 1229| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1230| 17700021 | The uid is not found. | 1231 1232**Example** 1233 1234```ts 1235import { bundleManager } from '@kit.AbilityKit'; 1236import { BusinessError } from '@kit.BasicServicesKit'; 1237import { hilog } from '@kit.PerformanceAnalysisKit'; 1238let uid = 20010005; 1239try { 1240 bundleManager.getBundleNameByUid(uid, (err, data) => { 1241 if (err) { 1242 hilog.error(0x0000, 'testTag', 'getBundleNameByUid failed: %{public}s', err.message); 1243 } else { 1244 hilog.info(0x0000, 'testTag', 'getBundleNameByUid successfully: %{public}s', JSON.stringify(data)); 1245 } 1246 }); 1247} catch (err) { 1248 let message = (err as BusinessError).message; 1249 hilog.error(0x0000, 'testTag', 'getBundleNameByUid failed: %{public}s', message); 1250} 1251``` 1252 1253### bundleManager.getBundleNameByUid<sup>14+</sup> 1254 1255getBundleNameByUid(uid: number): Promise\<string> 1256 1257Obtains the bundle name based on the given UID. This API uses a promise to return the result. 1258 1259**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1260 1261**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1262 1263**Parameters** 1264 1265| Name| Type | Mandatory| Description | 1266| ---- | ------ | ---- | ------------------ | 1267| uid | number | Yes | UID of the application.| 1268 1269**Return value** 1270 1271| Type | Description | 1272| ---------------- | --------------------------- | 1273| Promise\<string> | Promise used to return the bundle name obtained.| 1274 1275**Error codes** 1276 1277For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1278 1279| ID| Error Message | 1280| -------- | ---------------------| 1281| 201 | Permission denied. | 1282| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1283| 17700021 | The uid is not found. | 1284 1285**Example** 1286 1287```ts 1288import { bundleManager } from '@kit.AbilityKit'; 1289import { BusinessError } from '@kit.BasicServicesKit'; 1290import { hilog } from '@kit.PerformanceAnalysisKit'; 1291let uid = 20010005; 1292try { 1293 bundleManager.getBundleNameByUid(uid).then((data) => { 1294 hilog.info(0x0000, 'testTag', 'getBundleNameByUid successfully. Data: %{public}s', JSON.stringify(data)); 1295 }).catch((err: BusinessError) => { 1296 hilog.error(0x0000, 'testTag', 'getBundleNameByUid failed. Cause: %{public}s', err.message); 1297 }); 1298} catch (err) { 1299 let message = (err as BusinessError).message; 1300 hilog.error(0x0000, 'testTag', 'getBundleNameByUid failed. Cause: %{public}s', message); 1301} 1302``` 1303 1304### bundleManager.getBundleNameByUidSync<sup>14+</sup> 1305 1306getBundleNameByUidSync(uid: number): string 1307 1308Obtains the bundle name based on the given UID. This API returns the result synchronously. 1309 1310**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1311 1312**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1313 1314**Parameters** 1315 1316| Name| Type | Mandatory| Description | 1317| ---- | ------ | ---- | ------------------ | 1318| uid | number | Yes | UID of the application.| 1319 1320**Return value** 1321 1322| Type | Description | 1323| ---------------- | --------------------------- | 1324| string | Bundle name obtained.| 1325 1326**Error codes** 1327 1328For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1329 1330| ID| Error Message | 1331| -------- | ---------------------| 1332| 201 | Permission denied. | 1333| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1334| 17700021 | The uid is not found. | 1335 1336**Example** 1337 1338```ts 1339import { bundleManager } from '@kit.AbilityKit'; 1340import { BusinessError } from '@kit.BasicServicesKit'; 1341import { hilog } from '@kit.PerformanceAnalysisKit'; 1342let uid = 20010005; 1343try { 1344 let data = bundleManager.getBundleNameByUidSync(uid); 1345 hilog.info(0x0000, 'testTag', 'getBundleNameByUidSync successfully. Data: %{public}s', JSON.stringify(data)); 1346} catch (err) { 1347 let message = (err as BusinessError).message; 1348 hilog.error(0x0000, 'testTag', 'getBundleNameByUidSync failed. Cause: %{public}s', message); 1349} 1350``` 1351 1352### bundleManager.getAppCloneIdentity<sup>14+</sup> 1353 1354getAppCloneIdentity(uid: number): Promise\<AppCloneIdentity>; 1355 1356Obtains the bundle name and app index of an application clone based on the given UID. This API uses a promise to return the result. 1357 1358**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1359 1360**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1361 1362**Parameters** 1363 1364| Name | Type | Mandatory| Description | 1365| ---------- | ------ | ---- | ---------------------------| 1366| uid | number | Yes | UID of the application. | 1367 1368**Return value** 1369 1370| Type | Description | 1371| ----------------------------------------------------------- | --------------------------- | 1372| Promise\<AppCloneIdentity> | Promise used to return \<AppCloneIdentity>.| 1373 1374**Error codes** 1375 1376For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md). 1377 1378| ID| Error Message | 1379| -------- | --------------------------------------| 1380| 201 | Permission denied. | 1381| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.| 1382| 17700021 | The uid is not found. | 1383 1384**Example** 1385 1386```ts 1387import { bundleManager } from '@kit.AbilityKit'; 1388import { BusinessError } from '@kit.BasicServicesKit'; 1389import { hilog } from '@kit.PerformanceAnalysisKit'; 1390let uid = 20010005; 1391 1392try { 1393 bundleManager.getAppCloneIdentity(uid).then((res) => { 1394 hilog.info(0x0000, 'testTag', 'getAppCloneIdentity res = %{public}s', JSON.stringify(res)); 1395 }).catch((err: BusinessError) => { 1396 hilog.error(0x0000, 'testTag', 'getAppCloneIdentity failed. Cause: %{public}s', err.message); 1397 }); 1398} catch (err) { 1399 let message = (err as BusinessError).message; 1400 hilog.error(0x0000, 'testTag', 'getAppCloneIdentity failed. Cause: %{public}s', message); 1401} 1402``` 1403 1404### ApplicationInfo 1405 1406type ApplicationInfo = _ApplicationInfo 1407 1408Defines the application information. 1409 1410**Atomic service API**: This API can be used in atomic services since API version 11. 1411 1412**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1413 1414| Type | Description | 1415| ------------------------------------------------------------ | -------------- | 1416| [_ApplicationInfo](js-apis-bundleManager-applicationInfo.md#applicationinfo-1) | Application information.| 1417 1418### ModuleMetadata<sup>10+</sup> 1419 1420type ModuleMetadata = _ModuleMetadata 1421 1422Defines the metadata of a module. 1423 1424**Atomic service API**: This API can be used in atomic services since API version 11. 1425 1426**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1427 1428| Type | Description | 1429| ------------------------------------------------------------ | -------------- | 1430| [_ModuleMetadata](js-apis-bundleManager-applicationInfo.md#ModuleMetadata10) | Metadata of the module.| 1431 1432### Metadata 1433 1434type Metadata = _Metadata 1435 1436Defines the metadata. 1437 1438**Atomic service API**: This API can be used in atomic services since API version 11. 1439 1440**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1441 1442| Type | Description | 1443| ------------------------------------------------------------ | -------------- | 1444| [_Metadata](js-apis-bundleManager-metadata.md#metadata) | Metadata.| 1445 1446### BundleInfo 1447 1448type BundleInfo = _BundleInfo.BundleInfo 1449 1450Defines the bundle information. 1451 1452**Atomic service API**: This API can be used in atomic services since API version 11. 1453 1454**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1455 1456| Type | Description | 1457| ------------------------------------------------------------ | -------------- | 1458| [_BundleInfo.BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo) | Bundle information.| 1459 1460 1461### UsedScene 1462 1463type UsedScene = _BundleInfo.UsedScene 1464 1465Defines the use scenario and timing for using the permission. 1466 1467**Atomic service API**: This API can be used in atomic services since API version 11. 1468 1469**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1470 1471| Type | Description | 1472| ------------------------------------------------------------ | -------------- | 1473| [_BundleInfo.UsedScene](js-apis-bundleManager-bundleInfo.md#usedscene) | Use scenario and timing for using the permission.| 1474 1475### ReqPermissionDetail 1476 1477type ReqPermissionDetail = _BundleInfo.ReqPermissionDetail 1478 1479Defines the detailed information of the permissions to request from the system. 1480 1481**Atomic service API**: This API can be used in atomic services since API version 11. 1482 1483**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1484 1485| Type | Description | 1486| ------------------------------------------------------------ | -------------- | 1487| [_BundleInfo.ReqPermissionDetail](js-apis-bundleManager-bundleInfo.md#reqpermissiondetail) | Detailed information of the permissions to request from the system.| 1488 1489### SignatureInfo 1490 1491type SignatureInfo = _BundleInfo.SignatureInfo 1492 1493Defines the signature information of the bundle. 1494 1495**Atomic service API**: This API can be used in atomic services since API version 11. 1496 1497**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1498 1499| Type | Description | 1500| ------------------------------------------------------------ | -------------- | 1501| [_BundleInfo.SignatureInfo](js-apis-bundleManager-bundleInfo.md#signatureinfo) | Signature information of the bundle.| 1502 1503### HapModuleInfo 1504 1505type HapModuleInfo = _HapModuleInfo.HapModuleInfo 1506 1507Defines the HAP module information. 1508 1509**Atomic service API**: This API can be used in atomic services since API version 11. 1510 1511**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1512 1513| Type | Description | 1514| ------------------------------------------------------------ | -------------- | 1515| [_HapModuleInfo.HapModuleInfo](js-apis-bundleManager-hapModuleInfo.md#hapmoduleinfo-1) | HAP module information.| 1516 1517### PreloadItem 1518 1519type PreloadItem = _HapModuleInfo.PreloadItem 1520 1521Defines the preloaded module information in the atomic service. 1522 1523**Atomic service API**: This API can be used in atomic services since API version 11. 1524 1525**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1526 1527| Type | Description | 1528| ------------------------------------------------------------ | -------------- | 1529| [_HapModuleInfo.PreloadItem](js-apis-bundleManager-hapModuleInfo.md#preloaditem) | Preloaded module information in the atomic service.| 1530 1531### Dependency 1532 1533type Dependency = _HapModuleInfo.Dependency 1534 1535Defines the information about the dynamic shared libraries on which the module depends. 1536 1537**Atomic service API**: This API can be used in atomic services since API version 11. 1538 1539**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1540 1541| Type | Description | 1542| ------------------------------------------------------------ | -------------- | 1543| [_HapModuleInfo.Dependency](js-apis-bundleManager-hapModuleInfo.md#dependency) | Information about the dynamic shared libraries on which the module depends.| 1544 1545### RouterItem<sup>12+</sup> 1546 1547type RouterItem = _HapModuleInfo.RouterItem 1548 1549Defines the router table configuration of the module. 1550 1551**Atomic service API**: This API can be used in atomic services since API version 12. 1552 1553**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1554 1555| Type | Description | 1556| ------------------------------------------------------------ | -------------- | 1557| [_HapModuleInfo.RouterItem](js-apis-bundleManager-hapModuleInfo.md#routeritem12) | Router table configuration of the module.| 1558 1559### DataItem<sup>12+</sup> 1560 1561type DataItem = _HapModuleInfo.DataItem 1562 1563Defines the user-defined data in the routing table configuration of the module. 1564 1565**Atomic service API**: This API can be used in atomic services since API version 12. 1566 1567**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1568 1569| Type | Description | 1570| ------------------------------------------------------------ | -------------- | 1571| [_HapModuleInfo.DataItem](js-apis-bundleManager-hapModuleInfo.md#dataitem12) | User-defined data in the routing table configuration of the module.| 1572 1573### AbilityInfo 1574 1575type AbilityInfo = _AbilityInfo.AbilityInfo 1576 1577Defines the ability information. 1578 1579**Atomic service API**: This API can be used in atomic services since API version 11. 1580 1581**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1582 1583| Type | Description | 1584| ------------------------------------------------------------ | -------------- | 1585| [_AbilityInfo.AbilityInfo](js-apis-bundleManager-abilityInfo.md#abilityinfo-1) |Ability information.| 1586 1587### WindowSize 1588 1589type WindowSize = _AbilityInfo.WindowSize 1590 1591Defines the window size. 1592 1593**Atomic service API**: This API can be used in atomic services since API version 11. 1594 1595**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1596 1597| Type | Description | 1598| ------------------------------------------------------------ | -------------- | 1599| [_AbilityInfo.WindowSize](js-apis-bundleManager-abilityInfo.md#windowsize) |Window size.| 1600 1601 1602### ExtensionAbilityInfo 1603 1604type ExtensionAbilityInfo = _ExtensionAbilityInfo.ExtensionAbilityInfo 1605 1606Defines the ExtensionAbility information. 1607 1608**Atomic service API**: This API can be used in atomic services since API version 11. 1609 1610**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1611 1612| Type | Description | 1613| ------------------------------------------------------------ | -------------- | 1614| [_ExtensionAbilityInfo.ExtensionAbilityInfo](js-apis-bundleManager-extensionAbilityInfo.md#extensionabilityinfo-1) |ExtensionAbility information.| 1615 1616### ElementName 1617 1618type ElementName = _ElementName 1619 1620Defines the element name. 1621 1622**Atomic service API**: This API can be used in atomic services since API version 11. 1623 1624**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1625 1626| Type | Description | 1627| ------------------------------------------------------------ | -------------- | 1628| [_ElementName](js-apis-bundleManager-elementName.md#elementname-1) |Element name.| 1629 1630### Skill<sup>12+</sup> 1631 1632type Skill = _Skill.Skill 1633 1634Defines the skill information. 1635 1636**Atomic service API**: This API can be used in atomic services since API version 12. 1637 1638**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1639 1640| Type | Description | 1641| ------------------------------------------------------------ | -------------- | 1642| [_Skill.Skill](js-apis-bundleManager-skill.md#skill-1) |Skill information.| 1643 1644### SkillUrl<sup>12+</sup> 1645 1646type SkillUrl = _Skill.SkillUri 1647 1648Defines the SkillUri information. 1649 1650**Atomic service API**: This API can be used in atomic services since API version 12. 1651 1652**System capability**: SystemCapability.BundleManager.BundleFramework.Core 1653 1654| Type | Description | 1655| ------------------------------------------------------------ | -------------- | 1656| [_Skill.SkillUri](js-apis-bundleManager-skill.md#skilluri) |SkillUri information.| 1657