1e41f4b71Sopenharmony_ci# @ohos.bundle.distributedBundleManager (distributedBundleManager) (System API)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciThe **distributedBundle** module provides APIs for managing distributed bundles.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> 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.
8e41f4b71Sopenharmony_ci>
9e41f4b71Sopenharmony_ci> The APIs provided by this module are system APIs.
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci## Modules to Import
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci``` ts
14e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
15e41f4b71Sopenharmony_ci```
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci## System Capabilities
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciSystemCapability.BundleManager.DistributedBundleFramework
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci## Required Permissions
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci| Permission                                      | APL    | Description              |
24e41f4b71Sopenharmony_ci| ------------------------------------------ | ------------ | ------------------ |
25e41f4b71Sopenharmony_ci| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | Permission to obtain basic information and other sensitive information about a bundle. |
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ciFor details about the APL, see [Basic Concepts in the Permission Mechanism](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism).
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAbilityInfo>): void
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ciObtains information about the remote ability that matches the given element name. This API uses an asynchronous callback to return the result.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**System API**: This is a system API.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
40e41f4b71Sopenharmony_ci
41e41f4b71Sopenharmony_ci**Parameters**
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci| Name     | Type                                                        | Mandatory | Description                                                        |
44e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
45e41f4b71Sopenharmony_ci| elementName | [ElementName](js-apis-bundleManager-elementName.md)          | Yes  | Target element name.                                           |
46e41f4b71Sopenharmony_ci| callback    | AsyncCallback<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **RemoteAbilityInfo** object obtained. Otherwise, **err** is an error object and **data** is **undefined**. |
47e41f4b71Sopenharmony_ci
48e41f4b71Sopenharmony_ci**Error codes**
49e41f4b71Sopenharmony_ci
50e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
51e41f4b71Sopenharmony_ci
52e41f4b71Sopenharmony_ci| ID |    Error Message                  |
53e41f4b71Sopenharmony_ci|----------|--------------------------------------|
54e41f4b71Sopenharmony_ci| 201 | Permission denied. |
55e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
56e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
57e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
58e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
59e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
60e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
61e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**Example**
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci```ts
66e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
67e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_citry {
70e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
71e41f4b71Sopenharmony_ci        {
72e41f4b71Sopenharmony_ci            deviceId: '1',
73e41f4b71Sopenharmony_ci            bundleName: 'com.example.application',
74e41f4b71Sopenharmony_ci            abilityName: 'EntryAbility'
75e41f4b71Sopenharmony_ci        }, (err: BusinessError, data: distributedBundle.RemoteAbilityInfo) => {
76e41f4b71Sopenharmony_ci            if (err) {
77e41f4b71Sopenharmony_ci                console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
78e41f4b71Sopenharmony_ci            } else {
79e41f4b71Sopenharmony_ci                console.info('Operation succeed:' + JSON.stringify(data));
80e41f4b71Sopenharmony_ci            }
81e41f4b71Sopenharmony_ci        });
82e41f4b71Sopenharmony_ci} catch (err) {
83e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
84e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
85e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
86e41f4b71Sopenharmony_ci}
87e41f4b71Sopenharmony_ci```
88e41f4b71Sopenharmony_ci
89e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
90e41f4b71Sopenharmony_ci
91e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ciObtains information about the remote ability that matches the given element name. This API uses a promise to return the result.
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci**System API**: This is a system API.
96e41f4b71Sopenharmony_ci
97e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ci**Parameters**
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci| Name      | Type                                        | Mandatory | Description                   |
104e41f4b71Sopenharmony_ci| ----------- | -------------------------------------------- | ---- | ----------------------- |
105e41f4b71Sopenharmony_ci| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes  | Target element name. |
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci**Return value**
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_ci| Type                                                        | Description                             |
110e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | --------------------------------- |
111e41f4b71Sopenharmony_ci| Promise\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)> | Promise used to return the result. If the operation is successful, the **RemoteAbilityInfo** object is returned. Otherwise, an error object is returned. |
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**Error codes**
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci| ID |    Error Message                  |
118e41f4b71Sopenharmony_ci|----------|-------------------------|
119e41f4b71Sopenharmony_ci| 201 | Permission denied. |
120e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
121e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
122e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
123e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
124e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
125e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
126e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci**Example**
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci```ts
131e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
132e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_citry {
135e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
136e41f4b71Sopenharmony_ci        {
137e41f4b71Sopenharmony_ci            deviceId: '1',
138e41f4b71Sopenharmony_ci            bundleName: 'com.example.application',
139e41f4b71Sopenharmony_ci            abilityName: 'EntryAbility'
140e41f4b71Sopenharmony_ci        }).then((data: distributedBundle.RemoteAbilityInfo) => {
141e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
142e41f4b71Sopenharmony_ci        }).catch((err: BusinessError) => {
143e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
144e41f4b71Sopenharmony_ci        });
145e41f4b71Sopenharmony_ci} catch (err) {
146e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
147e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
148e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
149e41f4b71Sopenharmony_ci}
150e41f4b71Sopenharmony_ci```
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementNames: Array\<ElementName>, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ciObtains information about the remote abilities that match the given element names. This API uses an asynchronous callback to return the result.
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci**System API**: This is a system API.
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ci**Parameters**
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci| Name      | Type                                                        | Mandatory | Description                                                        |
167e41f4b71Sopenharmony_ci| ------------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
168e41f4b71Sopenharmony_ci| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)>   | Yes  | **ElementName** array, whose maximum length is 10.                            |
169e41f4b71Sopenharmony_ci| callback     | AsyncCallback\<Array\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)>> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of **RemoteAbilityInfo** objects obtained. Otherwise, **err** is an error object and **data** is **undefined**. |
170e41f4b71Sopenharmony_ci
171e41f4b71Sopenharmony_ci**Error codes**
172e41f4b71Sopenharmony_ci
173e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
174e41f4b71Sopenharmony_ci
175e41f4b71Sopenharmony_ci| ID |    Error Message                  |
176e41f4b71Sopenharmony_ci|----------|-------------------------|
177e41f4b71Sopenharmony_ci| 201 | Permission denied. |
178e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
179e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
180e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
181e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
182e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
183e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
184e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci**Example**
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci```ts
189e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
190e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_citry {
193e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
194e41f4b71Sopenharmony_ci        [
195e41f4b71Sopenharmony_ci            {
196e41f4b71Sopenharmony_ci                deviceId: '1',
197e41f4b71Sopenharmony_ci                bundleName: 'com.example.application1',
198e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility1'
199e41f4b71Sopenharmony_ci            },
200e41f4b71Sopenharmony_ci            {
201e41f4b71Sopenharmony_ci                deviceId: '1',
202e41f4b71Sopenharmony_ci                bundleName: 'com.example.application2',
203e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
204e41f4b71Sopenharmony_ci            }
205e41f4b71Sopenharmony_ci        ], (err: BusinessError, data: distributedBundle.RemoteAbilityInfo[]) => {
206e41f4b71Sopenharmony_ci          if (err) {
207e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
208e41f4b71Sopenharmony_ci          } else {
209e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
210e41f4b71Sopenharmony_ci          }
211e41f4b71Sopenharmony_ci        });
212e41f4b71Sopenharmony_ci} catch (err) {
213e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
214e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
215e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
216e41f4b71Sopenharmony_ci}
217e41f4b71Sopenharmony_ci```
218e41f4b71Sopenharmony_ci
219e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
220e41f4b71Sopenharmony_ci
221e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementNames: Array\<ElementName>): Promise\<Array\<RemoteAbilityInfo>>
222e41f4b71Sopenharmony_ci
223e41f4b71Sopenharmony_ciObtains information about the remote abilities that match the given element names. This API uses a promise to return the result.
224e41f4b71Sopenharmony_ci
225e41f4b71Sopenharmony_ci**System API**: This is a system API.
226e41f4b71Sopenharmony_ci
227e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
228e41f4b71Sopenharmony_ci
229e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
230e41f4b71Sopenharmony_ci
231e41f4b71Sopenharmony_ci**Parameters**
232e41f4b71Sopenharmony_ci
233e41f4b71Sopenharmony_ci| Name       | Type                                               | Mandatory | Description                   |
234e41f4b71Sopenharmony_ci| ------------ | --------------------------------------------------- | ---- | ----------------------- |
235e41f4b71Sopenharmony_ci| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes  | **ElementName** array, whose maximum length is 10. |
236e41f4b71Sopenharmony_ci
237e41f4b71Sopenharmony_ci**Return value**
238e41f4b71Sopenharmony_ci
239e41f4b71Sopenharmony_ci| Type                                                        | Description                             |
240e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | --------------------------------- |
241e41f4b71Sopenharmony_ci| Promise\<Array<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)>> | Promise used to return the result. If the operation is successful, an array of **RemoteAbilityInfo** objects is returned. Otherwise, an error object is returned. |
242e41f4b71Sopenharmony_ci
243e41f4b71Sopenharmony_ci**Error codes**
244e41f4b71Sopenharmony_ci
245e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
246e41f4b71Sopenharmony_ci
247e41f4b71Sopenharmony_ci| ID |    Error Message                  |
248e41f4b71Sopenharmony_ci|----------|-------------------------|
249e41f4b71Sopenharmony_ci| 201 | Permission denied. |
250e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
251e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
252e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
253e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
254e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
255e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
256e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci**Example**
259e41f4b71Sopenharmony_ci
260e41f4b71Sopenharmony_ci```ts
261e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
262e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
263e41f4b71Sopenharmony_ci
264e41f4b71Sopenharmony_citry {
265e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
266e41f4b71Sopenharmony_ci        [
267e41f4b71Sopenharmony_ci            {
268e41f4b71Sopenharmony_ci                deviceId: '1',
269e41f4b71Sopenharmony_ci                bundleName: 'com.example.application',
270e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
271e41f4b71Sopenharmony_ci            },
272e41f4b71Sopenharmony_ci            {
273e41f4b71Sopenharmony_ci                deviceId: '1',
274e41f4b71Sopenharmony_ci                bundleName: 'com.example.application2',
275e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
276e41f4b71Sopenharmony_ci            }
277e41f4b71Sopenharmony_ci        ]).then((data: distributedBundle.RemoteAbilityInfo[]) => {
278e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
279e41f4b71Sopenharmony_ci        }).catch((err: BusinessError) => {
280e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
281e41f4b71Sopenharmony_ci        });
282e41f4b71Sopenharmony_ci} catch (err) {
283e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
284e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
285e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
286e41f4b71Sopenharmony_ci}
287e41f4b71Sopenharmony_ci```
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback\<RemoteAbilityInfo>): void
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ciObtains information about the remote ability that matches the given element name and locale. This API uses an asynchronous callback to return the result.
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci**System API**: This is a system API.
296e41f4b71Sopenharmony_ci
297e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
298e41f4b71Sopenharmony_ci
299e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
300e41f4b71Sopenharmony_ci
301e41f4b71Sopenharmony_ci**Parameters**
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci| Name      | Type                                                        | Mandatory | Description                                              |
304e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
305e41f4b71Sopenharmony_ci| elementName | [ElementName](js-apis-bundleManager-elementName.md)                 | Yes  | Target element name.                           |
306e41f4b71Sopenharmony_ci| locale  | string |Yes | Target locale. |
307e41f4b71Sopenharmony_ci| callback    | AsyncCallback<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **RemoteAbilityInfo** object obtained. Otherwise, **err** is an error object and **data** is **undefined**. |
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_ci**Error codes**
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci| ID |    Error Message                  |
314e41f4b71Sopenharmony_ci|----------|-------------------------|
315e41f4b71Sopenharmony_ci| 201 | Permission denied. |
316e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
317e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
318e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
319e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
320e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
321e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
322e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
323e41f4b71Sopenharmony_ci
324e41f4b71Sopenharmony_ci**Example**
325e41f4b71Sopenharmony_ci
326e41f4b71Sopenharmony_ci```ts
327e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
328e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
329e41f4b71Sopenharmony_ci
330e41f4b71Sopenharmony_citry {
331e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
332e41f4b71Sopenharmony_ci        {
333e41f4b71Sopenharmony_ci            deviceId: '1',
334e41f4b71Sopenharmony_ci            bundleName: 'com.example.application',
335e41f4b71Sopenharmony_ci            abilityName: 'EntryAbility'
336e41f4b71Sopenharmony_ci        }, 'zh-Hans-CN', (err: BusinessError, data: distributedBundle.RemoteAbilityInfo) => {
337e41f4b71Sopenharmony_ci          if (err) {
338e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
339e41f4b71Sopenharmony_ci          } else {
340e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
341e41f4b71Sopenharmony_ci          }
342e41f4b71Sopenharmony_ci        });
343e41f4b71Sopenharmony_ci} catch (err) {
344e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
345e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
346e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
347e41f4b71Sopenharmony_ci}
348e41f4b71Sopenharmony_ci```
349e41f4b71Sopenharmony_ci
350e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
351e41f4b71Sopenharmony_ci
352e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\<RemoteAbilityInfo>
353e41f4b71Sopenharmony_ci
354e41f4b71Sopenharmony_ciObtains information about the remote ability that matches the given element name and locale. This API uses a promise to return the result.
355e41f4b71Sopenharmony_ci
356e41f4b71Sopenharmony_ci**System API**: This is a system API.
357e41f4b71Sopenharmony_ci
358e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
359e41f4b71Sopenharmony_ci
360e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
361e41f4b71Sopenharmony_ci
362e41f4b71Sopenharmony_ci**Parameters**
363e41f4b71Sopenharmony_ci
364e41f4b71Sopenharmony_ci| Name      | Type                                        | Mandatory | Description                   |
365e41f4b71Sopenharmony_ci| ----------- | -------------------------------------------- | ---- | ----------------------- |
366e41f4b71Sopenharmony_ci| elementName | [ElementName](js-apis-bundleManager-elementName.md) | Yes  | Target element name. |
367e41f4b71Sopenharmony_ci| locale  | string |Yes | Target locale. |
368e41f4b71Sopenharmony_ci
369e41f4b71Sopenharmony_ci**Return value**
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci| Type                                                        | Description                             |
372e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | --------------------------------- |
373e41f4b71Sopenharmony_ci| Promise\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)> | Promise used to return the result. If the operation is successful, the **RemoteAbilityInfo** object is returned. Otherwise, an error object is returned. |
374e41f4b71Sopenharmony_ci
375e41f4b71Sopenharmony_ci**Error codes**
376e41f4b71Sopenharmony_ci
377e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
378e41f4b71Sopenharmony_ci
379e41f4b71Sopenharmony_ci| ID |    Error Message                  |
380e41f4b71Sopenharmony_ci|----------|-------------------------|
381e41f4b71Sopenharmony_ci| 201 | Permission denied. |
382e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
383e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
384e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
385e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
386e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
387e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
388e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
389e41f4b71Sopenharmony_ci
390e41f4b71Sopenharmony_ci**Example**
391e41f4b71Sopenharmony_ci
392e41f4b71Sopenharmony_ci```ts
393e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
394e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
395e41f4b71Sopenharmony_ci
396e41f4b71Sopenharmony_citry {
397e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
398e41f4b71Sopenharmony_ci        {
399e41f4b71Sopenharmony_ci            deviceId: '1',
400e41f4b71Sopenharmony_ci            bundleName: 'com.example.application',
401e41f4b71Sopenharmony_ci            abilityName: 'EntryAbility'
402e41f4b71Sopenharmony_ci        }, 'zh-Hans-CN').then((data: distributedBundle.RemoteAbilityInfo) => {
403e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
404e41f4b71Sopenharmony_ci        }).catch((err: BusinessError) => {
405e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
406e41f4b71Sopenharmony_ci        });
407e41f4b71Sopenharmony_ci} catch (err) {
408e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
409e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
410e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
411e41f4b71Sopenharmony_ci}
412e41f4b71Sopenharmony_ci```
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
415e41f4b71Sopenharmony_ci
416e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ciObtains information about the remote abilities that match the given element names and locale. This API uses an asynchronous callback to return the result.
419e41f4b71Sopenharmony_ci
420e41f4b71Sopenharmony_ci**System API**: This is a system API.
421e41f4b71Sopenharmony_ci
422e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
423e41f4b71Sopenharmony_ci
424e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
425e41f4b71Sopenharmony_ci
426e41f4b71Sopenharmony_ci**Parameters**
427e41f4b71Sopenharmony_ci
428e41f4b71Sopenharmony_ci| Name       | Type                                                        | Mandatory | Description                                              |
429e41f4b71Sopenharmony_ci| ------------ | ------------------------------------------------------------ | ---- | -------------------------------------------------- |
430e41f4b71Sopenharmony_ci| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)>          | Yes  | **ElementName** array, whose maximum length is 10.                  |
431e41f4b71Sopenharmony_ci| locale  | string |Yes | Target locale. |
432e41f4b71Sopenharmony_ci| callback     | AsyncCallback\<Array\<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)>> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the array of **RemoteAbilityInfo** objects obtained. Otherwise, **err** is an error object and **data** is **undefined**. |
433e41f4b71Sopenharmony_ci
434e41f4b71Sopenharmony_ci**Error codes**
435e41f4b71Sopenharmony_ci
436e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
437e41f4b71Sopenharmony_ci
438e41f4b71Sopenharmony_ci| ID       |    Error Message                  |
439e41f4b71Sopenharmony_ci|---------------|-------------------------|
440e41f4b71Sopenharmony_ci| 201 | Permission denied. |
441e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
442e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
443e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
444e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
445e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
446e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
447e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
448e41f4b71Sopenharmony_ci
449e41f4b71Sopenharmony_ci**Example**
450e41f4b71Sopenharmony_ci
451e41f4b71Sopenharmony_ci```ts
452e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
453e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
454e41f4b71Sopenharmony_ci
455e41f4b71Sopenharmony_citry {
456e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
457e41f4b71Sopenharmony_ci        [
458e41f4b71Sopenharmony_ci            {
459e41f4b71Sopenharmony_ci                deviceId: '1',
460e41f4b71Sopenharmony_ci                bundleName: 'com.example.application1',
461e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility1'
462e41f4b71Sopenharmony_ci            },
463e41f4b71Sopenharmony_ci            {
464e41f4b71Sopenharmony_ci                deviceId: '1',
465e41f4b71Sopenharmony_ci                bundleName: 'com.example.application2',
466e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
467e41f4b71Sopenharmony_ci            }
468e41f4b71Sopenharmony_ci        ], 'zh-Hans-CN', (err: BusinessError, data: distributedBundle.RemoteAbilityInfo[]) => {
469e41f4b71Sopenharmony_ci          if (err) {
470e41f4b71Sopenharmony_ci           console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
471e41f4b71Sopenharmony_ci          } else {
472e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
473e41f4b71Sopenharmony_ci          }
474e41f4b71Sopenharmony_ci        });
475e41f4b71Sopenharmony_ci} catch (err) {
476e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
477e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
478e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
479e41f4b71Sopenharmony_ci}
480e41f4b71Sopenharmony_ci```
481e41f4b71Sopenharmony_ci
482e41f4b71Sopenharmony_ci## distributedBundle.getRemoteAbilityInfo
483e41f4b71Sopenharmony_ci
484e41f4b71Sopenharmony_cigetRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string): Promise\<Array\<RemoteAbilityInfo>>
485e41f4b71Sopenharmony_ci
486e41f4b71Sopenharmony_ciObtains information about the remote abilities that match the given element names and locale. This API uses a promise to return the result.
487e41f4b71Sopenharmony_ci
488e41f4b71Sopenharmony_ci**System API**: This is a system API.
489e41f4b71Sopenharmony_ci
490e41f4b71Sopenharmony_ci**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
491e41f4b71Sopenharmony_ci
492e41f4b71Sopenharmony_ci**System capability**: SystemCapability.BundleManager.DistributedBundleFramework
493e41f4b71Sopenharmony_ci
494e41f4b71Sopenharmony_ci**Parameters**
495e41f4b71Sopenharmony_ci
496e41f4b71Sopenharmony_ci| Name       | Type                                               | Mandatory | Description                   |
497e41f4b71Sopenharmony_ci| ------------ | --------------------------------------------------- | ---- | ----------------------- |
498e41f4b71Sopenharmony_ci| elementNames | Array<[ElementName](js-apis-bundleManager-elementName.md)> | Yes  | **ElementName** array, whose maximum length is 10. |
499e41f4b71Sopenharmony_ci| locale  | string |Yes | Target locale. |
500e41f4b71Sopenharmony_ci
501e41f4b71Sopenharmony_ci**Return value**
502e41f4b71Sopenharmony_ci
503e41f4b71Sopenharmony_ci| Type                                                        | Description                             |
504e41f4b71Sopenharmony_ci| ------------------------------------------------------------ | --------------------------------- |
505e41f4b71Sopenharmony_ci| Promise\<Array<[RemoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo-sys.md)>> | Promise used to return the result. If the operation is successful, an array of **RemoteAbilityInfo** objects is returned. Otherwise, an error object is returned. |
506e41f4b71Sopenharmony_ci
507e41f4b71Sopenharmony_ci**Error codes**
508e41f4b71Sopenharmony_ci
509e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [Bundle Error Codes](errorcode-bundle.md).
510e41f4b71Sopenharmony_ci
511e41f4b71Sopenharmony_ci| ID |    Error Message                  |
512e41f4b71Sopenharmony_ci|----------|-------------------------|
513e41f4b71Sopenharmony_ci| 201 | Permission denied. |
514e41f4b71Sopenharmony_ci| 202 | Permission denied, non-system app called system api. |
515e41f4b71Sopenharmony_ci| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types.|
516e41f4b71Sopenharmony_ci| 801 | Capability not supported. |
517e41f4b71Sopenharmony_ci| 17700001 | The specified bundle name is not found. |
518e41f4b71Sopenharmony_ci| 17700003 | The specified ability name is not found. |
519e41f4b71Sopenharmony_ci| 17700007 | The specified device ID is not found. |
520e41f4b71Sopenharmony_ci| 17700027 | The distributed service is not running. |
521e41f4b71Sopenharmony_ci
522e41f4b71Sopenharmony_ci**Example**
523e41f4b71Sopenharmony_ci
524e41f4b71Sopenharmony_ci```ts
525e41f4b71Sopenharmony_ciimport distributedBundle from '@ohos.bundle.distributedBundleManager';
526e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base';
527e41f4b71Sopenharmony_ci
528e41f4b71Sopenharmony_citry {
529e41f4b71Sopenharmony_ci    distributedBundle.getRemoteAbilityInfo(
530e41f4b71Sopenharmony_ci        [
531e41f4b71Sopenharmony_ci            {
532e41f4b71Sopenharmony_ci                deviceId: '1',
533e41f4b71Sopenharmony_ci                bundleName: 'com.example.application',
534e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
535e41f4b71Sopenharmony_ci            },
536e41f4b71Sopenharmony_ci            {
537e41f4b71Sopenharmony_ci                deviceId: '1',
538e41f4b71Sopenharmony_ci                bundleName: 'com.example.application2',
539e41f4b71Sopenharmony_ci                abilityName: 'EntryAbility'
540e41f4b71Sopenharmony_ci            }
541e41f4b71Sopenharmony_ci        ], 'zh-Hans-CN').then((data: distributedBundle.RemoteAbilityInfo[]) => {
542e41f4b71Sopenharmony_ci            console.info('Operation succeed:' + JSON.stringify(data));
543e41f4b71Sopenharmony_ci        }).catch((err: BusinessError) => {
544e41f4b71Sopenharmony_ci            console.log(`Operation failed: error code is ${err.code}  and error message is ${err.message}`);
545e41f4b71Sopenharmony_ci        });
546e41f4b71Sopenharmony_ci} catch (err) {
547e41f4b71Sopenharmony_ci    let code = (err as BusinessError).code;
548e41f4b71Sopenharmony_ci    let message = (err as BusinessError).message;
549e41f4b71Sopenharmony_ci    console.log(`Operation failed: error code is ${code}  and error message is ${message}`);
550e41f4b71Sopenharmony_ci}
551e41f4b71Sopenharmony_ci```
552