• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @system.package (Bundle Management)
2
3
4> **NOTE**
5>
6> - This module is deprecated since API version 9. You are advised to use [@ohos.bundle.bundleManager](js-apis-bundleManager.md) instead.
7>
8> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version.
9
10
11## Modules to Import
12
13
14```
15import package from '@system.package';
16```
17
18
19## package.hasInstalled<sup>(deprecated)</sup>
20> This API is deprecated since API version 9. You are advised to use [@ohos.bundle.bundleManager](js-apis-bundleManager.md) instead.
21
22hasInstalled(options: CheckPackageHasInstalledOptions): void
23
24Checks whether an application exists, or whether a native application has been installed.
25
26**System capability**: SystemCapability.BundleManager.BundleFramework
27
28**Parameters**
29
30| Name| Type| Mandatory| Description|
31| -------- | -------- | -------- | -------- |
32|options | [CheckPackageHasInstalledOptions](#checkpackagehasinstalledoptions) | Yes| Options.|
33
34**Return value**
35
36| Name| Type| Description|
37| -------- | -------- | -------- |
38| result | boolean | The value **true** means that the application exists or the native application has been installed, and **false** means the opposite.|
39
40**Example**
41
42``` ts
43export default {
44  hasInstalled() {
45    package.hasInstalled({
46      bundleName: 'com.example.bundlename',
47      success: function(data) {
48        console.log('package has installed: ' + data);
49      },
50      fail: function(data, code) {
51        console.log('query package fail, code: ' + code + ', data: ' + data);
52      },
53    });
54  },
55}
56```
57
58## CheckPackageHasInstalledResponse
59
60> This API is deprecated since API version 9.
61
62Checks whether a bundle has been installed.
63
64**System capability**: SystemCapability.BundleManager.BundleFramework
65
66| Name| Type| Mandatory| Description|
67| -------- | -------- | -------- | -------- |
68|result | boolean | Yes| The value **true** means that the bundle has been installed, and **false** means the opposite.|
69
70## CheckPackageHasInstalledOptions
71
72> This API is deprecated since API version 9.
73
74Defines the options used for checking whether a bundle has been installed.
75
76**System capability**: SystemCapability.BundleManager.BundleFramework
77
78| Name| Type| Mandatory| Description|
79| -------- | -------- | -------- | -------- |
80| bundleName | string | Yes| Bundle name.|
81| success | Function | No| Called when API call is successful.|
82| fail | Function | No| Called when API call has failed.|
83| complete | Function | No| Called when API call is complete.|
84