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