• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.bundle.installer (installer)
2
3The **bundle.installer** module provides APIs for you to install, uninstall, and recover bundles on devices.
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```js
12import installer from '@ohos.bundle.installer';
13```
14
15## Required Permissions
16
17| Permission                          | Permission Level   | Description            |
18| ------------------------------ | ----------- | ---------------- |
19| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall other applications except enterprise applications, including enterprise InHouse, mobile device management (MDM), and Normal applications.|
20| ohos.permission.INSTALL_ENTERPRISE_BUNDLE | system_core | Permission to install enterprise InHouse applications.|
21| ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE | system_core | Permission to install enterprise MDM applications.|
22| ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE | system_core | Permission to install enterprise Normal applications.|
23| ohos.permission.UNINSTALL_BUNDLE | system_core | Allows an application to uninstall applications.|
24| ohos.permission.RECOVER_BUNDLE | system_core | Allows an application to restore pre-installed applications.|
25| ohos.permission.INSTALL_SELF_BUNDLE | system_core | Allows automatic updates of the enterprise MDM applications on enterprise devices.|
26
27
28For details, see [Permission Levels](../../security/accesstoken-overview.md#permission-levels).
29
30## BundleInstaller.getBundleInstaller
31
32getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;
33
34Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result.
35
36**System API**: This is a system API.
37
38**System capability**: SystemCapability.BundleManager.BundleFramework.Core
39
40**Parameters**
41
42| Name  | Type                                                        | Mandatory| Description                                                        |
43| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
44| callback | AsyncCallback\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | Yes  | Callback used to return the result. If the operation is successful, **err** is **null** and **data** is the **BundleInstaller** object obtained; otherwise, **err** is an error object.|
45
46**Example**
47
48```ts
49import installer from '@ohos.bundle.installer';
50import { BusinessError } from '@ohos.base';
51
52try {
53    installer.getBundleInstaller((err: BusinessError, data: installer.BundleInstaller) => {
54        if (err) {
55            console.error('getBundleInstaller failed:' + err.message);
56        } else {
57            console.info('getBundleInstaller successfully');
58        }
59    });
60} catch (error) {
61    let message = (error as BusinessError).message;
62    console.error('getBundleInstaller failed:' + message);
63}
64```
65
66## BundleInstaller.getBundleInstaller
67
68getBundleInstaller(): Promise\<BundleInstaller>;
69
70Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result.
71
72**System API**: This is a system API.
73
74**System capability**: SystemCapability.BundleManager.BundleFramework.Core
75
76**Return value**
77| Type                                                        | Description                                |
78| ------------------------------------------------------------ | ------------------------------------ |
79| Promise\<[BundleInstaller](js-apis-installer.md#BundleInstaller)> | Promise used to return the **BundleInstaller** object obtained.|
80
81**Example**
82
83```ts
84import installer from '@ohos.bundle.installer';
85import { BusinessError } from '@ohos.base';
86
87try {
88    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
89        console.info('getBundleInstaller successfully.');
90    }).catch((error: BusinessError) => {
91        console.error('getBundleInstaller failed. Cause: ' + error.message);
92    });
93} catch (error) {
94    let message = (error as BusinessError).message;
95    console.error('getBundleInstaller failed. Cause: ' + message);
96}
97```
98
99## BundleInstaller.getBundleInstallerSync<sup>10+</sup>
100
101getBundleInstallerSync(): BundleInstaller;
102
103Obtains a **BundleInstaller** object. This API is a synchronous API.
104
105**System API**: This is a system API.
106
107**System capability**: SystemCapability.BundleManager.BundleFramework.Core
108
109**Return value**
110| Type                                                        | Description                                |
111| ------------------------------------------------------------ | ------------------------------------ |
112| [BundleInstaller](js-apis-installer.md#BundleInstaller) | **BundleInstaller** object.|
113
114**Example**
115
116```ts
117import installer from '@ohos.bundle.installer';
118import { BusinessError } from '@ohos.base';
119
120try {
121    installer.getBundleInstallerSync();
122    console.info('getBundleInstallerSync successfully.');
123} catch (error) {
124    let message = (error as BusinessError).message;
125    console.error('getBundleInstallerSync failed. Cause: ' + message);
126}
127```
128
129## BundleInstaller.install
130install(hapFilePaths: Array&lt;string&gt;, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void;
131
132Installs a bundle. This API uses an asynchronous callback to return the result.
133
134**System API**: This is a system API.
135
136**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
137> **NOTE**
138>
139> Since API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
140>
141> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
142>
143> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
144>
145> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
146>
147> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
148
149**System capability**: SystemCapability.BundleManager.BundleFramework.Core
150
151**Parameters**
152
153| Name          | Type                                                | Mandatory| Description                                                        |
154| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
155| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
156| installParam           | [InstallParam](#installparam)                        | Yes  | Parameters required for the installation.                                    |
157| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
158
159**Error codes**
160
161For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
162
163| ID| Error Message                                                    |
164| -------- | ------------------------------------------------------------ |
165| 17700004 | The specified user ID is not found.                          |
166| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
167| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
168| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
169| 17700015 | Failed to install the HAPs because they have different configuration information. |
170| 17700016 | Failed to install the HAP because of insufficient system disk space. |
171| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
172| 17700018 | Failed to install because the dependent module does not exist. |
173| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
174| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
175| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
176| 17700041 | Failed to install because enterprise device management disallow install. |
177| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
178| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
179| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
180| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
181| 17700048 | Failed to install the HAP because the code signature verification is failed. |
182| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
183
184**Example**
185
186```ts
187import installer from '@ohos.bundle.installer';
188import { BusinessError } from '@ohos.base';
189
190let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
191let installParam: installer.InstallParam = {
192    userId: 100,
193    isKeepData: false,
194    installFlag: 1,
195};
196
197try {
198    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
199        data.install(hapFilePaths, installParam, (err: BusinessError) => {
200            if (err) {
201                console.error('install failed:' + err.message);
202            } else {
203                console.info('install successfully.');
204            }
205        });
206    }).catch((error: BusinessError) => {
207        console.error('getBundleInstaller failed. Cause: ' + error.message);
208    });
209} catch (error) {
210    let message = (error as BusinessError).message;
211    console.error('getBundleInstaller failed. Cause: ' + message);
212}
213```
214## BundleInstaller.install
215install(hapFilePaths: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void;
216
217Installs a bundle. This API uses an asynchronous callback to return the result.
218
219**System API**: This is a system API.
220
221**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
222> **NOTE**
223>
224> Since API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
225>
226> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
227>
228> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
229>
230> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
231>
232> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
233
234**System capability**: SystemCapability.BundleManager.BundleFramework.Core
235
236**Parameters**
237
238| Name          | Type                                                | Mandatory| Description                                                        |
239| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
240| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
241| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
242
243**Error codes**
244
245For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
246
247| ID| Error Message                                                    |
248| -------- | ------------------------------------------------------------ |
249| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
250| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
251| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
252| 17700015 | Failed to install the HAPs because they have different configuration information. |
253| 17700016 | Failed to install the HAP because of insufficient system disk space. |
254| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
255| 17700018 | Failed to install because the dependent module does not exist. |
256| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
257| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
258| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
259| 17700041 | Failed to install because enterprise device management disallow install. |
260| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
261| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
262| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
263| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
264| 17700048 | Failed to install the HAP because the code signature verification is failed. |
265| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
266
267**Example**
268
269```ts
270import installer from '@ohos.bundle.installer';
271import { BusinessError } from '@ohos.base';
272
273let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
274
275try {
276    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
277        data.install(hapFilePaths, (err: BusinessError) => {
278            if (err) {
279                console.error('install failed:' + err.message);
280            } else {
281                console.info('install successfully.');
282            }
283        });
284    }).catch((error: BusinessError) => {
285        console.error('getBundleInstaller failed. Cause: ' + error.message);
286    });
287} catch (error) {
288    let message = (error as BusinessError).message;
289    console.error('getBundleInstaller failed. Cause: ' + message);
290}
291```
292
293## BundleInstaller.install
294
295install(hapFilePaths: Array\<string\>, installParam?: InstallParam) : Promise\<void\>;
296
297Installs a bundle. This API uses a promise to return the result.
298
299**System API**: This is a system API.
300
301**Required permissions**: ohos.permission.INSTALL_BUNDLE, ohos.permission.INSTALL_ENTERPRISE_BUNDLE<sup>10+</sup>, ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE<sup>10+</sup>, or ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE<sup>10+</sup>
302> **NOTE**
303>
304> Since API version 10, this API can be called with the permission **ohos.permission.INSTALL_ENTERPRISE_BUNDLE**, **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE**, or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE**.
305>
306> To install an enterprise application, you must have the **ohos.permission.INSTALL_ENTERPRISE_BUNDLE** permission.
307>
308> To install an enterprise Normal application, you must have the **ohos.permission.INSTALL_ENTERPRISE_NORMAL_BUNDLE** or **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
309>
310> To install an enterprise MDM application, you must have the **ohos.permission.INSTALL_ENTERPRISE_MDM_BUNDLE** permission.
311>
312> To install a common application, you must have the **ohos.permission.INSTALL_BUNDLE** permission.
313
314**System capability**: SystemCapability.BundleManager.BundleFramework.Core
315
316**Parameters**
317
318| Name      | Type                         | Mandatory| Description                                                        |
319| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
320| hapFilePaths | Array\<string\>               | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
321| installParam | [InstallParam](#installparam) | No  | Parameters required for the installation. For details about their default values, see [InstallParam](#installparam).                                    |
322
323**Return value**
324
325| Type           | Description                                  |
326| --------------- | -------------------------------------- |
327| Promise\<void\> | Promise that returns no value.|
328
329**Error codes**
330
331For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
332
333| ID| Error Message                                                    |
334| -------- | ------------------------------------------------------------ |
335| 17700004 | The specified user ID is not found.                          |
336| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
337| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
338| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
339| 17700015 | Failed to install the HAPs because they have different configuration information. |
340| 17700016 | Failed to install the HAP because of insufficient system disk space. |
341| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
342| 17700018 | Failed to install because the dependent module does not exist. |
343| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. |
344| 17700036 | Failed to install the HSP because lacks appropriate permissions. |
345| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
346| 17700041 | Failed to install because enterprise device management disallow install. |
347| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
348| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
349| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
350| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
351| 17700048 | Failed to install the HAP because the code signature verification is failed. |
352| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
353
354**Example**
355
356```ts
357import installer from '@ohos.bundle.installer';
358import { BusinessError } from '@ohos.base';
359
360let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
361let installParam: installer.InstallParam = {
362    userId: 100,
363    isKeepData: false,
364    installFlag: 1,
365};
366
367try {
368    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
369        data.install(hapFilePaths, installParam)
370            .then((data: void) => {
371                console.info('install successfully: ' + JSON.stringify(data));
372        }).catch((error: BusinessError) => {
373            console.error('install failed:' + error.message);
374        });
375    }).catch((error: BusinessError) => {
376        console.error('getBundleInstaller failed. Cause: ' + error.message);
377    });
378} catch (error) {
379    let message = (error as BusinessError).message;
380    console.error('getBundleInstaller failed. Cause: ' + message);
381}
382```
383
384## BundleInstaller.uninstall
385
386uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void;
387
388Uninstalls a bundle. This API uses an asynchronous callback to return the result.
389
390**System API**: This is a system API.
391
392**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
393
394**System capability**: SystemCapability.BundleManager.BundleFramework.Core
395
396**Parameters**
397
398| Name     | Type                                                | Mandatory| Description                                          |
399| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
400| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
401| installParam      | [InstallParam](#installparam)                        | Yes  | Parameters required for the uninstall.                      |
402| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
403
404**Error codes**
405
406For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
407
408| ID| Error Message                                                    |
409| -------- | ------------------------------------------------------------ |
410| 17700001 | The specified bundle name is not found. |
411| 17700004 | The specified user ID is not found. |
412| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
413| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
414| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
415
416**Example**
417
418```ts
419import installer from '@ohos.bundle.installer';
420import { BusinessError } from '@ohos.base';
421
422let bundleName = 'com.ohos.demo';
423let installParam: installer.InstallParam = {
424    userId: 100,
425    isKeepData: false,
426    installFlag: 1
427};
428
429try {
430    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
431        data.uninstall(bundleName, installParam, (err: BusinessError) => {
432            if (err) {
433                console.error('uninstall failed:' + err.message);
434            } else {
435                console.info('uninstall successfully.');
436            }
437        });
438    }).catch((error: BusinessError) => {
439        console.error('getBundleInstaller failed. Cause: ' + error.message);
440    });
441} catch (error) {
442    let message = (error as BusinessError).message;
443    console.error('getBundleInstaller failed. Cause: ' + message);
444}
445```
446
447## BundleInstaller.uninstall
448
449uninstall(bundleName: string, callback: AsyncCallback&lt;void&gt;): void;
450
451Uninstalls a bundle. This API uses an asynchronous callback to return the result.
452
453**System API**: This is a system API.
454
455**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
456
457**System capability**: SystemCapability.BundleManager.BundleFramework.Core
458
459**Parameters**
460
461| Name     | Type                                                | Mandatory| Description                                          |
462| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
463| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
464| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
465
466**Error codes**
467
468For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
469
470| ID| Error Message                                                    |
471| -------- | ------------------------------------------------------------ |
472| 17700001 | The specified bundle name is not found. |
473| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
474| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
475| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
476
477**Example**
478
479```ts
480import installer from '@ohos.bundle.installer';
481import { BusinessError } from '@ohos.base';
482
483let bundleName = 'com.ohos.demo';
484
485try {
486    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
487        data.uninstall(bundleName, (err: BusinessError) => {
488            if (err) {
489                console.error('uninstall failed:' + err.message);
490            } else {
491                console.info('uninstall successfully.');
492            }
493        });
494    }).catch((error: BusinessError) => {
495        console.error('getBundleInstaller failed. Cause: ' + error.message);
496    });
497} catch (error) {
498    let message = (error as BusinessError).message;
499    console.error('getBundleInstaller failed. Cause: ' + message);
500}
501```
502## BundleInstaller.uninstall
503
504uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
505
506Uninstalls a bundle. This API uses a promise to return the result.
507
508**System API**: This is a system API.
509
510**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
511
512**System capability**: SystemCapability.BundleManager.BundleFramework.Core
513
514**Parameters**
515
516| Name      | Type                         | Mandatory| Description                                                        |
517| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
518| bundleName | string                          | Yes  | Name of the target bundle.                                          |
519| installParam | [InstallParam](#installparam) | No  | Parameters required for the uninstall. For details about their default values, see [InstallParam](#installparam).                                    |
520
521**Return value**
522
523| Type           | Description                                  |
524| --------------- | -------------------------------------- |
525| Promise\<void\> | Promise that returns no value.|
526
527**Error codes**
528
529For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
530
531| ID| Error Message                                                    |
532| -------- | ------------------------------------------------------------ |
533| 17700001 | The specified bundle name is not found. |
534| 17700004 | The specified user ID is not found. |
535| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
536| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. |
537| 17700045 | Failed to uninstall because enterprise device management disallow uninstall. |
538
539**Example**
540```ts
541import installer from '@ohos.bundle.installer';
542import { BusinessError } from '@ohos.base';
543
544let bundleName = 'com.ohos.demo';
545let installParam: installer.InstallParam = {
546    userId: 100,
547    isKeepData: false,
548    installFlag: 1,
549};
550
551try {
552    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
553        data.uninstall(bundleName, installParam)
554            .then((data: void) => {
555                console.info('uninstall successfully: ' + JSON.stringify(data));
556        }).catch((error: BusinessError) => {
557            console.error('uninstall failed:' + error.message);
558        });
559    }).catch((error: BusinessError) => {
560        console.error('getBundleInstaller failed. Cause: ' + error.message);
561    });
562} catch (error) {
563    let message = (error as BusinessError).message;
564    console.error('getBundleInstaller failed. Cause: ' + message);
565}
566```
567
568## BundleInstaller.recover
569
570recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback&lt;void&gt;): void;
571
572Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
573
574**System API**: This is a system API.
575
576**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
577
578**System capability**: SystemCapability.BundleManager.BundleFramework.Core
579
580**Parameters**
581
582| Name     | Type                                                | Mandatory| Description                                          |
583| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
584| bundleName | string                                               | Yes  | Name of the target bundle.                                          |
585| installParam      | [InstallParam](#installparam)                        | Yes  | Parameters required for the recovery.                      |
586| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
587
588**Error codes**
589
590For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
591
592| ID| Error Message                           |
593| -------- | ----------------------------------- |
594| 17700001 | The specified bundle name is not found. |
595| 17700004 | The specified user ID is not found. |
596
597**Example**
598
599```ts
600import installer from '@ohos.bundle.installer';
601import { BusinessError } from '@ohos.base';
602
603let bundleName = 'com.ohos.demo';
604let installParam: installer.InstallParam = {
605    userId: 100,
606    isKeepData: false,
607    installFlag: 1
608};
609
610try {
611    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
612        data.recover(bundleName, installParam, (err: BusinessError) => {
613            if (err) {
614                console.error('recover failed:' + err.message);
615            } else {
616                console.info('recover successfully.');
617            }
618        });
619    }).catch((error: BusinessError) => {
620        console.error('getBundleInstaller failed. Cause: ' + error.message);
621    });
622} catch (error) {
623    let message = (error as BusinessError).message;
624    console.error('getBundleInstaller failed. Cause: ' + message);
625}
626```
627
628
629## BundleInstaller.recover
630
631recover(bundleName: string, callback: AsyncCallback&lt;void&gt;): void;
632
633Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result.
634
635**System API**: This is a system API.
636
637**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
638
639**System capability**: SystemCapability.BundleManager.BundleFramework.Core
640
641**Parameters**
642
643| Name     | Type                                                | Mandatory| Description                                          |
644| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- |
645| bundleName | string                                               | Yes  | Name of the target bundle.                              |
646| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
647
648**Error codes**
649
650For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
651
652| ID| Error Message                           |
653| -------- | ----------------------------------- |
654| 17700001 | The specified bundle name is not found. |
655
656**Example**
657
658```ts
659import installer from '@ohos.bundle.installer';
660import { BusinessError } from '@ohos.base';
661
662let bundleName = 'com.ohos.demo';
663
664try {
665    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
666        data.recover(bundleName, (err: BusinessError) => {
667            if (err) {
668                console.error('recover failed:' + err.message);
669            } else {
670                console.info('recover successfully.');
671            }
672        });
673    }).catch((error: BusinessError) => {
674        console.error('getBundleInstaller failed. Cause: ' + error.message);
675    });
676} catch (error) {
677    let message = (error as BusinessError).message;
678    console.error('getBundleInstaller failed. Cause: ' + message);
679}
680```
681
682## BundleInstaller.recover
683
684recover(bundleName: string, installParam?: InstallParam) : Promise\<void\>;
685
686Rolls back a bundle to the initial installation state. This API uses a promise to return the result.
687
688**System API**: This is a system API.
689
690**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.RECOVER_BUNDLE
691
692**System capability**: SystemCapability.BundleManager.BundleFramework.Core
693
694**Parameters**
695
696| Name      | Type                         | Mandatory| Description                                                        |
697| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ |
698| bundleName | string                          | Yes  | Name of the target bundle.                                          |
699| installParam | [InstallParam](#installparam) | No  | Parameters required for the recovery. For details about their default values, see [InstallParam](#installparam).                                    |
700
701**Return value**
702
703| Type           | Description                                  |
704| --------------- | -------------------------------------- |
705| Promise\<void\> | Promise that returns no value.|
706
707**Error codes**
708
709For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
710
711| ID| Error Message                           |
712| -------- | ----------------------------------- |
713| 17700001 | The specified bundle name is not found. |
714| 17700004 | The specified user ID is not found. |
715
716**Example**
717```ts
718import installer from '@ohos.bundle.installer';
719import { BusinessError } from '@ohos.base';
720
721let bundleName = 'com.ohos.demo';
722let installParam: installer.InstallParam = {
723    userId: 100,
724    isKeepData: false,
725    installFlag: 1,
726};
727
728try {
729    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
730        data.recover(bundleName, installParam)
731            .then((data: void) => {
732                console.info('recover successfully: ' + JSON.stringify(data));
733        }).catch((error: BusinessError) => {
734            console.error('recover failed:' + error.message);
735        });
736    }).catch((error: BusinessError) => {
737        console.error('getBundleInstaller failed. Cause: ' + error.message);
738    });
739} catch (error) {
740    let message = (error as BusinessError).message;
741    console.error('getBundleInstaller failed. Cause: ' + message);
742}
743```
744
745## BundleInstaller.uninstall<sup>10+</sup>
746
747uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\<void>) : void ;
748
749Uninstalls a shared bundle. This API uses an asynchronous callback to return the result.
750
751**System API**: This is a system API.
752
753**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
754
755**System capability**: SystemCapability.BundleManager.BundleFramework.Core
756
757**Parameters**
758
759| Name        | Type                               | Mandatory| Description                                                    |
760| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- |
761| uninstallParam | [UninstallParam](#uninstallparam10) | Yes  | Parameters required for the uninstall.                            |
762| callback       | AsyncCallback&lt;void&gt;           | Yes  | Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
763
764**Error codes**
765
766For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
767
768| ID| Error Message                                                    |
769| -------- | ------------------------------------------------------------ |
770| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
771| 17700037 | The version of shared bundle is dependent on other applications. |
772| 17700038 | The specified shared bundle does not exist.                  |
773
774**Example**
775
776```ts
777import installer from '@ohos.bundle.installer';
778import { BusinessError } from '@ohos.base';
779
780let uninstallParam: installer.UninstallParam = {
781    bundleName: "com.ohos.demo",
782};
783
784try {
785    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
786        data.uninstall(uninstallParam, (err: BusinessError) => {
787            if (err) {
788                console.error('uninstall failed:' + err.message);
789            } else {
790                console.info('uninstall successfully.');
791            }
792        });
793    }).catch((error: BusinessError) => {
794        console.error('getBundleInstaller failed. Cause: ' + error.message);
795    });
796} catch (error) {
797    let message = (error as BusinessError).message;
798    console.error('getBundleInstaller failed. Cause: ' + message);
799}
800```
801
802## BundleInstaller.uninstall<sup>10+</sup>
803
804uninstall(uninstallParam: UninstallParam) : Promise\<void>;
805
806Uninstalls a shared bundle. This API uses a promise to return the result.
807
808**System API**: This is a system API.
809
810**Required permissions**: ohos.permission.INSTALL_BUNDLE or ohos.permission.UNINSTALL_BUNDLE
811
812**System capability**: SystemCapability.BundleManager.BundleFramework.Core
813
814**Parameters**
815
816| Name        | Type                               | Mandatory| Description                        |
817| -------------- | ----------------------------------- | ---- | ---------------------------- |
818| uninstallParam | [UninstallParam](#uninstallparam10) | Yes  | Parameters required for the uninstall.|
819
820**Return value**
821
822| Type         | Description                                  |
823| ------------- | -------------------------------------- |
824| Promise\<void\> | Promise that returns no value.|
825
826**Error codes**
827
828For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
829
830| ID| Error Message                                                    |
831| -------- | ------------------------------------------------------------ |
832| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. |
833| 17700037 | The version of shared bundle is dependent on other applications. |
834| 17700038 | The specified shared bundle does not exist.                  |
835
836**Example**
837
838```ts
839import installer from '@ohos.bundle.installer';
840import { BusinessError } from '@ohos.base';
841
842let uninstallParam: installer.UninstallParam = {
843    bundleName: "com.ohos.demo",
844};
845
846try {
847    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
848        data.uninstall(uninstallParam, (err: BusinessError) => {
849            if (err) {
850                console.error('uninstall failed:' + err.message);
851            } else {
852                console.info('uninstall successfully.');
853            }
854        });
855    }).catch((error: BusinessError) => {
856        console.error('getBundleInstaller failed. Cause: ' + error.message);
857    });
858} catch (error) {
859    let message = (error as BusinessError).message;
860    console.error('getBundleInstaller failed. Cause: ' + message);
861}
862```
863
864## BundleInstaller.updateBundleForSelf<sup>10+</sup>
865
866updateBundleForSelf(hapFilePaths: Array\<string\>, installParam: InstallParam, callback: AsyncCallback\<void\>): void;
867
868Updates the current bundle. This API uses an asynchronous callback to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
869
870**System API**: This is a system API.
871
872**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
873
874**System capability**: SystemCapability.BundleManager.BundleFramework.Core
875
876**Parameters**
877
878| Name          | Type                                                | Mandatory| Description                                                        |
879| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
880| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
881| installParam           | [InstallParam](#installparam)                        | Yes  | Parameters required for the installation.                                    |
882| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
883
884**Error codes**
885
886For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
887
888| ID| Error Message                                                    |
889| -------- | ------------------------------------------------------------ |
890| 17700004 | The specified user ID is not found.                          |
891| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
892| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
893| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
894| 17700015 | Failed to install the HAPs because they have different configuration information. |
895| 17700016 | Failed to install the HAP because of insufficient system disk space. |
896| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
897| 17700018 | Failed to install because the dependent module does not exist. |
898| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
899| 17700041 | Failed to install because enterprise device management disallow install. |
900| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
901| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
902| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
903| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
904| 17700048 | Failed to install the HAP because the code signature verification is failed. |
905| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
906| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
907| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
908
909**Example**
910
911```ts
912import installer from '@ohos.bundle.installer';
913import { BusinessError } from '@ohos.base';
914
915let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
916let installParam: installer.InstallParam = {
917    userId: 100,
918    isKeepData: false,
919    installFlag: 1,
920};
921
922try {
923    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
924        data.updateBundleForSelf(hapFilePaths, installParam, (err: BusinessError) => {
925            if (err) {
926                console.error('updateBundleForSelf failed:' + err.message);
927            } else {
928                console.info('updateBundleForSelf successfully.');
929            }
930        });
931    }).catch((error: BusinessError) => {
932        console.error('getBundleInstaller failed. Cause: ' + error.message);
933    });
934} catch (error) {
935    let message = (error as BusinessError).message;
936    console.error('getBundleInstaller failed. Cause: ' + message);
937}
938```
939
940## BundleInstaller.updateBundleForSelf<sup>10+</sup>
941
942updateBundleForSelf(hapFilePaths: Array\<string\>, callback: AsyncCallback\<void\>): void;
943
944Updates the current bundle. This API uses an asynchronous callback to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
945
946**System API**: This is a system API.
947
948**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
949
950**System capability**: SystemCapability.BundleManager.BundleFramework.Core
951
952**Parameters**
953
954| Name          | Type                                                | Mandatory| Description                                                        |
955| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
956| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
957| callback | AsyncCallback&lt;void&gt; | Yes| Callback used to return the result. If the operation is successful, **err** is **null**; otherwise, **err** is an error object.|
958
959**Error codes**
960
961For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
962
963| ID| Error Message                                                    |
964| -------- | ------------------------------------------------------------ |
965| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
966| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
967| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
968| 17700015 | Failed to install the HAPs because they have different configuration information. |
969| 17700016 | Failed to install the HAP because of insufficient system disk space. |
970| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
971| 17700018 | Failed to install because the dependent module does not exist. |
972| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
973| 17700041 | Failed to install because enterprise device management disallow install. |
974| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
975| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
976| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
977| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
978| 17700048 | Failed to install the HAP because the code signature verification is failed. |
979| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
980| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
981| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
982
983**Example**
984
985```ts
986import installer from '@ohos.bundle.installer';
987import { BusinessError } from '@ohos.base';
988
989let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
990
991try {
992    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
993        data.updateBundleForSelf(hapFilePaths, (err: BusinessError) => {
994            if (err) {
995                console.error('updateBundleForSelf failed:' + err.message);
996            } else {
997                console.info('updateBundleForSelf successfully.');
998            }
999        });
1000    }).catch((error: BusinessError) => {
1001        console.error('getBundleInstaller failed. Cause: ' + error.message);
1002    });
1003} catch (error) {
1004    let message = (error as BusinessError).message;
1005    console.error('getBundleInstaller failed. Cause: ' + message);
1006}
1007```
1008
1009## BundleInstaller.updateBundleForSelf<sup>10+</sup>
1010
1011updateBundleForSelf(hapFilePaths: Array\<string\>, installParam?: InstallParam): Promise\<void\>;
1012
1013Updates the current bundle. This API uses a promise to return the result. It can be called only by enterprise MDM applications on enterprise devices, and the HAPs in **hapFilePaths** must belong to the current application.
1014
1015**System API**: This is a system API.
1016
1017**Required permissions**: ohos.permission.INSTALL_SELF_BUNDLE
1018
1019**System capability**: SystemCapability.BundleManager.BundleFramework.Core
1020
1021**Parameters**
1022
1023| Name          | Type                                                | Mandatory| Description                                                        |
1024| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ |
1025| hapFilePaths | Array&lt;string&gt;                                  | Yes  | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.|
1026| installParam | [InstallParam](#installparam) | No  | Parameters required for the installation. For details about their default values, see [InstallParam](#installparam).                                    |
1027
1028**Error codes**
1029
1030For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
1031
1032| ID| Error Message                                                    |
1033| -------- | ------------------------------------------------------------ |
1034| 17700004 | The specified user ID is not found.                          |
1035| 17700010 | Failed to install the HAP because the HAP fails to be parsed. |
1036| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. |
1037| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. |
1038| 17700015 | Failed to install the HAPs because they have different configuration information. |
1039| 17700016 | Failed to install the HAP because of insufficient system disk space. |
1040| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. |
1041| 17700018 | Failed to install because the dependent module does not exist. |
1042| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. |
1043| 17700041 | Failed to install because enterprise device management disallow install. |
1044| 17700042 | Failed to install the HAP because of incorrect URI in the data proxy. |
1045| 17700043 | Failed to install the HAP because of low APL in the non-system data proxy (required APL: system_basic or system_core). |
1046| 17700044 | Failed to install the HAP because the isolationMode configured is not supported. |
1047| 17700047 | Failed to install the HAP because the VersionCode to be updated is not greater than the current VersionCode. |
1048| 17700048 | Failed to install the HAP because the code signature verification is failed. |
1049| 17700049 | Failed to install the HAP because the bundleName is different from the bundleName of the caller application. |
1050| 17700050 | Failed to install the HAP because enterprise normal/MDM bundle cannot be installed on non-enterprise device. |
1051| 17700051 | Failed to install the HAP because the distribution type of caller application is not enterprise_mdm. |
1052
1053**Example**
1054
1055```ts
1056import installer from '@ohos.bundle.installer';
1057import { BusinessError } from '@ohos.base';
1058
1059let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/'];
1060let installParam: installer.InstallParam = {
1061    userId: 100,
1062    isKeepData: false,
1063    installFlag: 1,
1064};
1065
1066try {
1067    installer.getBundleInstaller().then((data: installer.BundleInstaller) => {
1068        data.updateBundleForSelf(hapFilePaths, installParam)
1069            .then((data: void) => {
1070                console.info('updateBundleForSelf successfully: ' + JSON.stringify(data));
1071        }).catch((error: BusinessError) => {
1072            console.error('updateBundleForSelf failed:' + error.message);
1073        });
1074    }).catch((error: BusinessError) => {
1075        console.error('getBundleInstaller failed. Cause: ' + error.message);
1076    });
1077} catch (error) {
1078    let message = (error as BusinessError).message;
1079    console.error('getBundleInstaller failed. Cause: ' + message);
1080}
1081```
1082
1083## HashParam
1084
1085Defines the hash parameters for bundle installation and uninstall.
1086
1087 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1088
1089 **System API**: This is a system API.
1090
1091| Name    | Type  | Mandatory| Description            |
1092| ---------- | ------ | ---------------- | ---------------- |
1093| moduleName | string | Yes| Module name of the bundle.|
1094| hashValue  | string | Yes| Hash value.          |
1095
1096## InstallParam
1097
1098Defines the parameters that need to be specified for bundle installation, uninstall, or recovering.
1099
1100 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1101
1102 **System API**: This is a system API.
1103
1104| Name                       | Type                          | Mandatory                        | Description              |
1105| ------------------------------ | ------------------------------ | ------------------ | ------------------ |
1106| 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. You can call [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user ID of the current process.|
1107| installFlag                    | number                         | No                       | Installation flag. The value **0x00** means initial installation, **0x01** means overwrite installation, and **0x10** means installation-free. The default value is **0x00**.|
1108| isKeepData                     | boolean                        | No                      | Whether to retain the data directory during bundle uninstall. The default value is **false**.|
1109| hashParams        | Array<[HashParam](#hashparam)> | No| Hash parameters. By default, no value is passed.        |
1110| crowdtestDeadline| number                         | No                       | End date of crowdtesting. The default value is **-1**, indicating that no end date is specified for crowdtesting.|
1111| sharedBundleDirPaths<sup>10+</sup> | Array\<String> | No|Paths of the shared bundle files. By default, no value is passed.|
1112| specifiedDistributionType<sup>10+</sup> | string | No|Distribution type specified during application installation. By default, no value is passed. The maximum length is 128 bytes. This field is usually specified by the application market of the operating system operator.|
1113| additionalInfo<sup>10+</sup> | string | No|Additional information during application installation (usually an enterprise application). By default, no value is passed. The maximum length is 3,000 bytes. This field is usually specified by the application market of the operating system operator.|
1114| verifyCodeParams<sup>10+</sup> | Array<[VerifyCodeParam](#verifycodeparam10)> | No| Information about the code signature file. The default value is null.        |
1115
1116## UninstallParam<sup>10+</sup>
1117
1118Defines the parameters required for the uninstall of a shared bundle.
1119
1120 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1121
1122 **System API**: This is a system API.
1123
1124| Name       | Type  | Mandatory| Description                                                        |
1125| ----------- | ------ | ---- | ------------------------------------------------------------ |
1126| bundleName  | string | Yes  | Name of the shared bundle.                                                |
1127| versionCode | number | No  | Version number of the shared bundle. By default, no value is passed, and all shared bundles of the specified name are uninstalled.|
1128
1129## VerifyCodeParam<sup>10+</sup>
1130
1131Defines the information about the code signature file.
1132
1133 **System capability**: SystemCapability.BundleManager.BundleFramework.Core
1134
1135 **System API**: This is a system API.
1136
1137| Name    | Type  | Mandatory| Description            |
1138| ---------- | ------ | ---------------- | ---------------- |
1139| moduleName | string | Yes| Module name of the bundle.|
1140| signatureFilePath  | string | Yes| Path of the code signature file.          |
1141