• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @system.package (Bundle Management)
2<!--Kit: Ability Kit-->
3<!--Subsystem: BundleManager-->
4<!--Owner: @wanghang904-->
5<!--Designer: @hanfeng6-->
6<!--Tester: @kongjing2-->
7<!--Adviser: @Brilliantry_Rui-->
8
9
10> **NOTE**
11>
12> - This module is deprecated since API version 9. You are advised to use [@ohos.bundle.bundleManager](js-apis-bundleManager.md) instead.
13>
14> - 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.
15
16
17## Modules to Import
18
19
20```
21import package from '@system.package';
22```
23
24
25## package.hasInstalled<sup>(deprecated)</sup>
26> This API is deprecated since API version 9. You are advised to use [@ohos.bundle.bundleManager](js-apis-bundleManager.md) instead.
27
28hasInstalled(options: CheckPackageHasInstalledOptions): void
29
30Checks whether an application exists, or whether a native application has been installed.
31
32**System capability**: SystemCapability.BundleManager.BundleFramework
33
34**Parameters**
35
36| Name| Type| Mandatory| Description|
37| -------- | -------- | -------- | -------- |
38|options | [CheckPackageHasInstalledOptions](#checkpackagehasinstalledoptions) | Yes| Options.|
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| Check result for whether the bundle has been installed. **true** if installed, **false** otherwise.|
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