• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.bundle.bundleResourceManager (bundleResourceManager) (System API)
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9The module provides APIs for obtaining resource information, including [BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md) and [LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md).
10
11> **NOTE**
12>
13> The initial APIs of this module are supported since API version 11. Newly added APIs will be marked with a superscript to indicate their earliest API version.
14>
15> Starting from API version 12, this module supports query of icons and names of disabled applications and applications installed by all users.
16>
17> The APIs provided by this module are system APIs.
18
19## Modules to Import
20
21```ts
22import { bundleResourceManager } from '@kit.AbilityKit';
23```
24
25## Enums
26
27### ResourceFlag
28
29Enumerates the resource information flags, which indicate the type of resource information to obtain.
30
31**System API**: This is a system API.
32
33**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
34
35| Name                                                    | Value        | Description                                                        |
36| -------------------------------------------------------- | ---------- | ------------------------------------------------------------ |
37| GET_RESOURCE_INFO_ALL                                    | 0x00000001 | Both the application icon and label are obtained.                               |
38| GET_RESOURCE_INFO_WITH_LABEL                             | 0x00000002 | Only the application label is obtained.                     |
39| GET_RESOURCE_INFO_WITH_ICON                              | 0x00000004 | Only the application icon is obtained.                     |
40| GET_RESOURCE_INFO_WITH_SORTED_BY_LABEL                   | 0x00000008 | The obtained information is sorted by label. It must be used together with **GET_RESOURCE_INFO_ALL** or **GET_RESOURCE_INFO_WITH_LABEL**.|
41| GET_RESOURCE_INFO_WITH_DRAWABLE_DESCRIPTOR<sup>12+</sup> | 0x00000010 | The [drawableDescriptor](../apis-arkui/js-apis-arkui-drawableDescriptor-sys.md) object of the application icon is obtained.|
42| GET_RESOURCE_INFO_ONLY_WITH_MAIN_ABILITY<sup>20+</sup>   | 0x00000020 | The resource information about abilities that show icons only on the home screen is obtained. It is valid only in the [getLauncherAbilityResourceInfo](#bundleresourcemanagergetlauncherabilityresourceinfo) and [getAllLauncherAbilityResourceInfo](#bundleresourcemanagergetalllauncherabilityresourceinfo) APIs.|
43
44
45## APIs
46
47### bundleResourceManager.getBundleResourceInfo
48
49getBundleResourceInfo(bundleName: string, resourceFlags?: [number](#resourceflag)): [BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)
50
51Obtains the resource information of an application based on the given bundle name and resource flags. This API returns the result synchronously.
52
53**System API**: This is a system API.
54
55**Required permissions**: ohos.permission.GET_BUNDLE_RESOURCES
56
57**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
58
59**Parameters**
60
61| Name    | Type  | Mandatory| Description               |
62| ----------- | ------ | ---- | --------------------- |
63| bundleName | string | Yes  | Bundle name of the application.|
64| resourceFlags | [number](#resourceflag) | No  | Type of the resource information to obtain.|
65
66**Return value**
67
68| Type                                                       | Description                                 |
69| ----------------------------------------------------------- | ------------------------------------- |
70| [BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md) | Resource information of the application obtained.|
71
72
73**Error codes**
74
75For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
76
77| ID| Error Message                             |
78| -------- | ------------------------------------- |
79| 201 | Permission denied. |
80| 202 | Permission denied, non-system app called system api. |
81| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
82| 17700001 | The specified bundleName is not found. |
83
84
85**Example**
86
87```ts
88import { bundleResourceManager } from '@kit.AbilityKit';
89import { BusinessError } from '@ohos.base';
90import hilog from '@ohos.hilog';
91let bundleName = "com.example.myapplication";
92let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
93try {
94    let resourceInfo = bundleResourceManager.getBundleResourceInfo(bundleName, resourceFlag);
95    hilog.info(0x0000, 'testTag', 'getBundleResourceInfo successfully. Data label: %{public}s', JSON.stringify(resourceInfo.label));
96} catch (err) {
97    let message = (err as BusinessError).message;
98    hilog.error(0x0000, 'testTag', 'getBundleResourceInfo failed: %{public}s', message);
99}
100```
101
102### bundleResourceManager.getLauncherAbilityResourceInfo
103
104getLauncherAbilityResourceInfo(bundleName: string, resourceFlags?: [number](#resourceflag)): Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>
105
106Obtains the bundle information of the entry ability of an application based on the given bundle name and resource flags. This API returns the result synchronously.
107
108**System API**: This is a system API.
109
110**Required permissions**: ohos.permission.GET_BUNDLE_RESOURCES
111
112**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
113
114**Parameters**
115
116| Name    | Type  | Mandatory| Description               |
117| ----------- | ------ | ---- | --------------------- |
118| bundleName | string | Yes  | Bundle name of the application.|
119| resourceFlags | [number](#resourceflag) | No  | Type of the resource information to obtain. The default value is **[ResourceFlag](#resourceflag).GET_RESOURCE_INFO_ALL**.|
120
121**Return value**
122
123| Type                                                       | Description                                 |
124| ----------------------------------------------------------- | ------------------------------------- |
125| Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)> | Resource information of the entry ability obtained.|
126
127**Error codes**
128
129For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
130
131| ID| Error Message                             |
132| -------- | ------------------------------------- |
133| 201 | Permission denied. |
134| 202 | Permission denied, non-system app called system api. |
135| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
136| 17700001 | The specified bundleName is not found. |
137
138
139**Example**
140
141```ts
142import { bundleResourceManager } from '@kit.AbilityKit';
143import { BusinessError } from '@ohos.base';
144import hilog from '@ohos.hilog';
145let bundleName = "com.example.myapplication";
146let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
147try {
148    let resourceInfo = bundleResourceManager.getLauncherAbilityResourceInfo(bundleName, resourceFlag);
149    hilog.info(0x0000, 'testTag', 'getLauncherAbilityResourceInfo successfully. Data label: %{public}s', JSON.stringify(resourceInfo[0].label));
150} catch (err) {
151    let message = (err as BusinessError).message;
152    hilog.error(0x0000, 'testTag', 'getLauncherAbilityResourceInfo failed: %{public}s', message);
153}
154```
155
156### bundleResourceManager.getAllBundleResourceInfo
157
158getAllBundleResourceInfo(resourceFlags: [number](#resourceflag), callback: AsyncCallback<Array<[BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)>>): void
159
160Obtains the bundle resource information of all applications based on the given resource flags. This API uses an asynchronous callback to return the result.
161
162**System API**: This is a system API.
163
164**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST and ohos.permission.GET_BUNDLE_RESOURCES
165
166**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
167
168**Parameters**
169
170| Name    | Type  | Mandatory| Description               |
171| ----------- | ------ | ---- | --------------------- |
172| resourceFlags | [number](#resourceflag) | Yes  | Type of the resource information to obtain.|
173| callback | AsyncCallback\<Array<[BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)>> | Yes| [Callback](../apis-basic-services-kit/js-apis-base.md#asynccallback) used to return the result. If the information is successfully obtained, **err** is **null** and **data** is the bundle resource information. Otherwise, **err** is an error object.|
174
175**Error codes**
176
177For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
178
179| ID| Error Message                             |
180| -------- | ------------------------------------- |
181| 201 | Permission denied. |
182| 202 | Permission denied, non-system app called system api. |
183| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
184
185**Example**
186
187```ts
188import { bundleResourceManager } from '@kit.AbilityKit';
189import { BusinessError } from '@ohos.base';
190import hilog from '@ohos.hilog';
191let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
192try {
193    bundleResourceManager.getAllBundleResourceInfo(resourceFlag, (err, data) => {
194        if (err) {
195            hilog.error(0x0000, 'testTag', 'getAllBundleResourceInfo failed. err: %{public}s', err.message);
196            return;
197        }
198        hilog.info(0x0000, 'testTag', 'getAllBundleResourceInfo successfully. Data length: %{public}s', JSON.stringify(data.length));
199    });
200} catch (err) {
201    let message = (err as BusinessError).message;
202    hilog.error(0x0000, 'testTag', 'getAllBundleResourceInfo failed: %{public}s', message);
203}
204```
205
206### bundleResourceManager.getAllBundleResourceInfo
207
208getAllBundleResourceInfo(resourceFlags: [number](#resourceflag)): Promise<Array<[BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)>>;
209
210Obtains the bundle resource information of all applications based on the given resource flags. This API uses a promise to return the result.
211
212**System API**: This is a system API.
213
214**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST and ohos.permission.GET_BUNDLE_RESOURCES
215
216**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
217
218**Parameters**
219
220| Name    | Type  | Mandatory| Description               |
221| ----------- | ------ | ---- | --------------------- |
222| resourceFlags | [number](#resourceflag) | Yes  | Type of the resource information to obtain.|
223
224**Return value**
225
226| Type                                                        | Description                            |
227| ------------------------------------------------------------ | -------------------------------- |
228| Promise\<Array<[BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)>> | Promise used to return the resource information of the application obtained.|
229
230**Error codes**
231
232For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
233
234| ID| Error Message                             |
235| -------- | ------------------------------------- |
236| 201 | Permission denied. |
237| 202 | Permission denied, non-system app called system api. |
238| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
239
240**Example**
241
242```ts
243import { bundleResourceManager } from '@kit.AbilityKit';
244import { BusinessError } from '@ohos.base';
245import hilog from '@ohos.hilog';
246let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
247try {
248    bundleResourceManager.getAllBundleResourceInfo(resourceFlag).then(data=> {
249        hilog.info(0x0000, 'testTag', 'getAllBundleResourceInfo successfully. Data length: %{public}s', JSON.stringify(data.length));
250    }).catch((err: BusinessError) => {
251        hilog.error(0x0000, 'testTag', 'getAllBundleResourceInfo failed. err: %{public}s', err.message);
252    })
253} catch (err) {
254    let message = (err as BusinessError).message;
255    hilog.error(0x0000, 'testTag', 'getAllBundleResourceInfo failed: %{public}s', message);
256}
257```
258
259### bundleResourceManager.getAllLauncherAbilityResourceInfo
260
261getAllLauncherAbilityResourceInfo(resourceFlags: [number](#resourceflag), callback: AsyncCallback<Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>>): void
262
263Obtains the resource information of the entry abilities of the current application based on the given resource flags. This API uses an asynchronous callback to return the result.
264
265**System API**: This is a system API.
266
267**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST and ohos.permission.GET_BUNDLE_RESOURCES
268
269**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
270
271**Parameters**
272
273| Name    | Type  | Mandatory| Description               |
274| ----------- | ------ | ---- | --------------------- |
275| resourceFlags | [number](#resourceflag) | Yes  | Type of the resource information to obtain.|
276| callback | AsyncCallback\<Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>> | Yes| [Callback](../apis-basic-services-kit/js-apis-base.md#asynccallback) used to return the result. If the information is successfully obtained, **err** is **null** and **data** is the launcher ability resource information. Otherwise, **err** is an error object.|
277
278**Error codes**
279
280For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
281
282| ID| Error Message                             |
283| -------- | ------------------------------------- |
284| 201 | Permission denied. |
285| 202 | Permission denied, non-system app called system api. |
286| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
287
288**Example**
289
290```ts
291import { bundleResourceManager } from '@kit.AbilityKit';
292import { BusinessError } from '@ohos.base';
293import hilog from '@ohos.hilog';
294let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
295try {
296    bundleResourceManager.getAllLauncherAbilityResourceInfo(resourceFlag, (err, data) => {
297        if (err) {
298            hilog.error(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo failed. err: %{public}s', err.message);
299            return;
300        }
301        hilog.info(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo successfully. Data length: %{public}s', JSON.stringify(data.length));
302    });
303} catch (err) {
304    let message = (err as BusinessError).message;
305    hilog.error(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo failed: %{public}s', message);
306}
307```
308
309### bundleResourceManager.getAllLauncherAbilityResourceInfo
310
311getAllLauncherAbilityResourceInfo(resourceFlags: [number](#resourceflag)): Promise<Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>>
312
313Obtains the resource information of the entry abilities of the current application based on the given resource flags. This API uses a promise to return the result.
314
315**System API**: This is a system API.
316
317**Required permissions**: ohos.permission.GET_INSTALLED_BUNDLE_LIST and ohos.permission.GET_BUNDLE_RESOURCES
318
319**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
320
321**Parameters**
322
323| Name    | Type  | Mandatory| Description               |
324| ----------- | ------ | ---- | --------------------- |
325| resourceFlags | [number](#resourceflag) | Yes  | Type of the resource information to obtain.|
326
327**Return value**
328
329| Type                                                        | Description                            |
330| ------------------------------------------------------------ | -------------------------------- |
331| Promise\<Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>> | Promise used to return the resource information of the entry abilities obtained.|
332
333**Error codes**
334
335For details about the error codes, see [Universal Error Codes](../errorcode-universal.md).
336
337| ID| Error Message                             |
338| -------- | ------------------------------------- |
339| 201 | Permission denied. |
340| 202 | Permission denied, non-system app called system api. |
341| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
342
343**Example**
344```ts
345import { bundleResourceManager } from '@kit.AbilityKit';
346import { BusinessError } from '@ohos.base';
347import hilog from '@ohos.hilog';
348let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
349try {
350    bundleResourceManager.getAllLauncherAbilityResourceInfo(resourceFlag).then(data=> {
351        hilog.info(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo successfully. Data length: %{public}s', JSON.stringify(data.length));
352    }).catch((err: BusinessError) => {
353        hilog.error(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo failed. err: %{public}s', err.message);
354    })
355} catch (err) {
356    let message = (err as BusinessError).message;
357    hilog.error(0x0000, 'testTag', 'getAllLauncherAbilityResourceInfo failed: %{public}s', message);
358}
359```
360
361### bundleResourceManager.getBundleResourceInfo<sup>12+</sup>
362
363getBundleResourceInfo(bundleName: string, resourceFlags?: [number](#resourceflag), appIndex?: number): [BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md)
364
365Obtains the resource information of an application based on the given bundle name, resource flags, and app index. This API returns the result synchronously.
366
367**System API**: This is a system API.
368
369**Required permissions**: ohos.permission.GET_BUNDLE_RESOURCES
370
371**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
372
373**Parameters**
374
375| Name    | Type  | Mandatory| Description               |
376| ----------- | ------ | ---- | --------------------- |
377| bundleName | string | Yes  | Bundle name of the application.|
378| resourceFlags | [number](#resourceflag) | No  | Type of the resource information to obtain.|
379| appIndex | number | No  | Index of the application clone. The default value is **0**.|
380
381**Return value**
382
383| Type                                                       | Description                                 |
384| ----------------------------------------------------------- | ------------------------------------- |
385| [BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md) | Resource information of the application obtained.|
386
387
388**Error codes**
389
390For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
391
392| ID| Error Message                             |
393| -------- | ------------------------------------- |
394| 201 | Permission denied. |
395| 202 | Permission denied, non-system app called system api. |
396| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
397| 17700001 | The specified bundleName is not found. |
398| 17700061 | AppIndex not in valid range or not found. |
399
400
401**Example**
402
403```ts
404import { bundleResourceManager } from '@kit.AbilityKit';
405import { BusinessError } from '@ohos.base';
406import hilog from '@ohos.hilog';
407let bundleName = "com.example.myapplication";
408let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
409let appIndex = 1;
410try {
411    let resourceInfo = bundleResourceManager.getBundleResourceInfo(bundleName, resourceFlag, appIndex);
412    hilog.info(0x0000, 'testTag', 'getBundleResourceInfo successfully. Data label: %{public}s', JSON.stringify(resourceInfo.label));
413} catch (err) {
414    let message = (err as BusinessError).message;
415    hilog.error(0x0000, 'testTag', 'getBundleResourceInfo failed: %{public}s', message);
416}
417```
418
419### bundleResourceManager.getLauncherAbilityResourceInfo<sup>12+</sup>
420
421getLauncherAbilityResourceInfo(bundleName: string, resourceFlags?: [number](#resourceflag), appIndex?: number): Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)>
422
423Obtains the launcher ability resource information of an application based on the given bundle name, resource flags, and app index. This API returns the result synchronously.
424
425**System API**: This is a system API.
426
427**Required permissions**: ohos.permission.GET_BUNDLE_RESOURCES
428
429**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
430
431**Parameters**
432
433| Name    | Type  | Mandatory| Description               |
434| ----------- | ------ | ---- | --------------------- |
435| bundleName | string | Yes  | Bundle name of the application.|
436| resourceFlags | [number](#resourceflag) | No  | Type of the resource information to obtain. The default value is **[ResourceFlag](#resourceflag).GET_RESOURCE_INFO_ALL**.|
437| appIndex | number | No  | Index of the application clone. The default value is **0**.|
438
439**Return value**
440
441| Type                                                       | Description                                 |
442| ----------------------------------------------------------- | ------------------------------------- |
443| Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)> | Resource information of the entry ability obtained.|
444
445**Error codes**
446
447For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
448
449| ID| Error Message                             |
450| -------- | ------------------------------------- |
451| 201 | Permission denied. |
452| 202 | Permission denied, non-system app called system api. |
453| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
454| 17700001 | The specified bundleName is not found. |
455| 17700061 | AppIndex not in valid range or not found. |
456
457**Example**
458
459```ts
460import { bundleResourceManager } from '@kit.AbilityKit';
461import { BusinessError } from '@ohos.base';
462import hilog from '@ohos.hilog';
463let bundleName = "com.example.myapplication";
464let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
465let appIndex = 1;
466try {
467    let resourceInfo = bundleResourceManager.getLauncherAbilityResourceInfo(bundleName, resourceFlag, appIndex);
468    hilog.info(0x0000, 'testTag', 'getLauncherAbilityResourceInfo successfully. Data label: %{public}s', JSON.stringify(resourceInfo[0].label));
469} catch (err) {
470    let message = (err as BusinessError).message;
471    hilog.error(0x0000, 'testTag', 'getLauncherAbilityResourceInfo failed: %{public}s', message);
472}
473```
474
475### bundleResourceManager.getExtensionAbilityResourceInfo<sup>20+</sup>
476
477getExtensionAbilityResourceInfo(bundleName: string, extensionAbilityType: bundleManager.ExtensionAbilityType, resourceFlags: number, appIndex?: number): Array\<LauncherAbilityResourceInfo>
478
479Obtains the ExtensionAbility resource information of an application based on the bundle name, ExtensionAbility type, resource flags, and clone ID. This API returns the result synchronously.
480
481**System API**: This is a system API.
482
483**Required permissions**: ohos.permission.GET_BUNDLE_RESOURCES
484
485**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
486
487**Parameters**
488
489| Name    | Type  | Mandatory| Description               |
490| ----------- | ------ | ---- | --------------------- |
491| bundleName | string | Yes  | Bundle name of the application.|
492| extensionAbilityType | [bundleManager.ExtensionAbilityType](js-apis-bundleManager.md#extensionabilitytype) | Yes  | ExtensionAbility type. Only **ExtensionAbilityType.INPUT_METHOD**, **ExtensionAbilityType.SHARE** and **ExtensionAbilityType.ACTION** are supported.|
493| [resourceFlags](#resourceflag) | number | Yes  | Resource information flags, which indicate the type of resource information to obtain.|
494| appIndex | number | No  | ID of the application clone. The default value is **0**. The value ranges from 0 to 5. The value **0** indicates the main application.|
495
496**Return value**
497
498| Type                                                       | Description                                 |
499| ----------------------------------------------------------- | ------------------------------------- |
500| Array<[LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md)> | ExtensionAbility resource information of the application, including the icon and name.|
501
502**Error codes**
503
504For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
505
506| ID| Error Message                             |
507| -------- | ------------------------------------- |
508| 201 | Permission denied. |
509| 202 | Permission denied, non-system app called system api.|
510| 17700001 | The specified bundleName is not found. |
511| 17700061 | AppIndex not in valid range or not found. |
512
513**Example**
514
515```ts
516import { bundleManager, bundleResourceManager } from '@kit.AbilityKit';
517import { BusinessError } from '@kit.BasicServicesKit';
518
519let bundleName = "com.example.myapplication";
520let extensionAbilityType = bundleManager.ExtensionAbilityType.INPUT_METHOD;
521let resourceFlag = bundleResourceManager.ResourceFlag.GET_RESOURCE_INFO_ALL;
522try {
523    let resourceInfo = bundleResourceManager.getExtensionAbilityResourceInfo(bundleName, extensionAbilityType, resourceFlag);
524    console.info('getExtensionAbilityResourceInfo successfully. Data label: ' + JSON.stringify(resourceInfo[0].label));
525} catch (err) {
526    let message = (err as BusinessError).message;
527    let code = (err as BusinessError).code;
528    console.error(`getExtensionAbilityResourceInfo failed, err code:${code}, err msg: ${message}`);
529}
530```
531
532## BundleResourceInfo
533
534type BundleResourceInfo = _BundleResourceInfo
535
536Defines the icon and name of an application.
537
538**System API**: This is a system API.
539
540**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
541
542| Type                                                        | Description          |
543| ------------------------------------------------------------ | -------------- |
544| [_BundleResourceInfo](js-apis-bundleManager-BundleResourceInfo-sys.md#bundleresourceinfo) |Icon and name of the application.|
545
546## LauncherAbilityResourceInfo
547
548type LauncherAbilityResourceInfo = _LauncherAbilityResourceInfo
549
550Defines the entry icon and name of an application.
551
552**System API**: This is a system API.
553
554**System capability**: SystemCapability.BundleManager.BundleFramework.Resource
555
556| Type                                                        | Description          |
557| ------------------------------------------------------------ | -------------- |
558| [_LauncherAbilityResourceInfo](js-apis-bundleManager-LauncherAbilityResourceInfo-sys.md#launcherabilityresourceinfo) |Entry icon and name of the application.|
559