1# @ohos.bundle.launcherBundleManager (launcherBundleManager模块) 2<!--Kit: Ability Kit--> 3<!--Subsystem: BundleManager--> 4<!--Owner: @wanghang904--> 5<!--Designer: @hanfeng6--> 6<!--Tester: @kongjing2--> 7<!--Adviser: @Brilliantry_Rui--> 8 9本模块支持launcher应用所需的查询能力,支持[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息的查询。 10 11> **说明:** 12> 13> 本模块首批接口从API version 18开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 14 15## 导入模块 16 17```ts 18import { launcherBundleManager } from '@kit.AbilityKit'; 19``` 20 21## launcherBundleManager.getLauncherAbilityInfoSync 22 23getLauncherAbilityInfoSync(bundleName: string, userId: number) : Array\<[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)\> 24 25查询指定bundleName及用户的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)。 26 27**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED 28 29**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher 30 31**参数:** 32 33| 参数名 | 类型 | 必填 | 说明 | 34| ---------- | ------ | ---- | -------------- | 35| bundleName | string | 是 | 应用Bundle名称。 | 36| userId | number | 是 | 被查询的用户ID,可以通过[getOsAccountLocalId接口](../apis-basic-services-kit/js-apis-osAccount.md#getosaccountlocalid9)获取。 | 37 38**返回值:** 39 40| 类型 | 说明 | 41| ----------------------------- | -------------------------------------------------- | 42| Array\<[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)\> | Array形式返回bundle包含的[LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md)信息。 | 43 44**错误码:** 45 46以下错误码的详细介绍请参见[通用错误码](../errorcode-universal.md)和[ohos.bundle错误码](errorcode-bundle.md)。 47 48| 错误码ID | 错误信息 | 49| -------- | ---------------------------------------- | 50| 201 | Verify permission denied. | 51| 801 | Capability not support. | 52| 17700001 | The specified bundle name is not found. | 53| 17700004 | The specified user ID is not found. | 54 55**示例:** 56 57```ts 58import { launcherBundleManager } from '@kit.AbilityKit'; 59import { BusinessError } from '@kit.BasicServicesKit'; 60 61try { 62 let data = launcherBundleManager.getLauncherAbilityInfoSync("com.example.demo", 100); 63 console.info("data is " + JSON.stringify(data)); 64} catch (errData) { 65 let code = (errData as BusinessError).code; 66 let message = (errData as BusinessError).message; 67 console.error(`errData is errCode:${code} message:${message}`); 68} 69``` 70 71## LauncherAbilityInfo 72 73type LauncherAbilityInfo = _LauncherAbilityInfo 74 75LauncherAbilityInfo信息。 76 77**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher 78 79| 类型 | 说明 | 80| ------------------------------------------------------------ | -------------- | 81| [_LauncherAbilityInfo](js-apis-bundleManager-launcherAbilityInfo.md) | 桌面应用的Ability信息。 | 82 83## ShortcutInfo<sup>20+</sup> 84 85type ShortcutInfo = _ShortcutInfo 86 87应用[module.json5配置文件](../../quick-start/module-configuration-file.md#shortcuts标签)中定义的快捷方式信息。 88 89**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher 90 91| 类型 | 说明 | 92| ------------------------------------------------------------ | -------------- | 93| [_ShortcutInfo](./js-apis-bundleManager-shortcutInfo.md#shortcutinfo-1) | 应用module.json5配置文件中定义的快捷方式信息。 | 94 95## ShortcutWant<sup>20+</sup> 96 97type ShortcutWant = _ShortcutWant 98 99快捷方式内定义的目标[wants](../../quick-start/module-configuration-file.md#wants标签)信息集合。 100 101**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher 102 103| 类型 | 说明 | 104| ------------------------------------------------------------ | -------------- | 105| [_ShortcutWant](./js-apis-bundleManager-shortcutInfo.md#shortcutwant) | 快捷方式内定义的目标[wants](../../quick-start/module-configuration-file.md#wants标签)信息集合。 | 106 107## ParameterItem<sup>20+</sup> 108 109type ParameterItem = _ParameterItem 110 111快捷方式配置信息中的自定义数据。 112 113**系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher 114 115| 类型 | 说明 | 116| ------------------------------------------------------------ | -------------- | 117| [_ParameterItem](./js-apis-bundleManager-shortcutInfo.md#parameteritem) | 快捷方式配置信息中的自定义数据。 | 118 119