js-apis-Bundle-InnerBundleManager.md 13.1 KB
Newer Older
1
# @ohos.bundle.innerBundleManager
2

3
The **innerBundleManager** module provides APIs for the **Home Screen** application.
4

5
>
6
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
7
> This module is deprecated since API version 9. You are advised to use [launcherBundleManager](js-apis-launcherBundleManager.md) and [bundleMonitor](js-apis-bundleMonitor.md) instead.
8 9 10

## Modules to Import

11
```typescript
12 13 14 15 16 17 18 19
import innerBundleManager from '@ohos.bundle.innerBundleManager';
```

## System Capability

SystemCapability.BundleManager.BundleFramework


20
## innerBundleManager.getLauncherAbilityInfos<sup>(deprecated)</sup>
21 22 23 24

getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void;

Obtains the launcher ability information based on a given bundle name. This API uses an asynchronous callback to return the result.
25
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead.
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

41
| Name    | Type                                                        | Mandatory| Description                                                 |
42 43
| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- |
| bundleName | string                                                       | Yes  | Bundle name of an application.                             |
44
| userId     | number                                                       | Yes  | User ID. The value must be greater than or equal to 0.|
45 46 47
| callback   | AsyncCallback\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Yes  | Callback used to return an array of the launcher ability information.           |


48
## innerBundleManager.getLauncherAbilityInfos<sup>(deprecated)</sup>
49 50 51 52

getLauncherAbilityInfos(bundleName: string, userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt;

Obtains the launcher ability information based on a given bundle name. This API uses a promise to return the result.
53
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

69
| Name    | Type  | Mandatory| Description                                                 |
70 71
| ---------- | ------ | ---- | ----------------------------------------------------- |
| bundleName | string | Yes  | Bundle name of an application.                             |
72
| userId     | number | Yes  | User ID. The value must be greater than or equal to 0.|
73 74 75 76 77 78 79

**Return value**

| Type                                                        | Description                     |
| ------------------------------------------------------------ | ------------------------- |
| Promise\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Promise used to return an array of the launcher ability information.|

80
## innerBundleManager.on<sup>(deprecated)</sup>
81 82 83 84

on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback&lt;string&gt;) : void;

Registers a callback to receive bundle status changes. This API uses an asynchronous callback to return the result.
85
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#on](js-apis-bundleMonitor.md) instead.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100

**Required permissions**

ohos.permission.LISTEN_BUNDLE_CHANGE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

101
| Name             | Type                 | Mandatory| Description                                              |
102
| -------------------- | --------------------- | ---- | ---------------------------------------------------- |
G
Gloria 已提交
103 104
| type                 | string | Yes  | Event type. Only **BundleStatusChange** is supported.            |
| bundleStatusCallback | [BundleStatusCallback](js-apis-Bundle-BundleStatusCallback.md) | Yes  | Callback to register.                                  |
105 106
| callback             | AsyncCallback\<string> | Yes  | Callback used to return a successful result or error information.|

107
## innerBundleManager.on<sup>(deprecated)</sup>
108

109
on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback) : Promise&lt;string&gt;
110 111

Registers a callback to receive bundle status changes. This API uses a promise to return the result.
112
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#on](js-apis-bundleMonitor.md) instead.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127

**Required permissions**

ohos.permission.LISTEN_BUNDLE_CHANGE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

128
| Name              | Type                                                        | Mandatory| Description                                      |
G
Gloria 已提交
129 130 131
| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------ |
| type                 | string                                                       | Yes  | Event type. Only **BundleStatusChange** is supported.|
| bundleStatusCallback | [BundleStatusCallback](js-apis-Bundle-BundleStatusCallback.md) | Yes  | Callback to register.                        |
132 133 134 135 136 137 138

**Return value**

| Type           | Description                               |
| --------------- | ----------------------------------- |
| Promise\<string> | Promise used to return a successful result or error information.|

139
## innerBundleManager.off<sup>(deprecated)</sup>
140 141 142 143

off(type:"BundleStatusChange", callback: AsyncCallback&lt;string&gt;) : void;

Deregisters the callback that receives bundle status changes. This API uses an asynchronous callback to return the result.
144
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#off](js-apis-bundleMonitor.md) instead.
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159

**Required permissions**

ohos.permission.LISTEN_BUNDLE_CHANGE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

160
| Name | Type                 | Mandatory| Description                                              |
161
| -------- | --------------------- | ---- | ---------------------------------------------------- |
G
Gloria 已提交
162
| type     | string | Yes  | Event type. Only **BundleStatusChange** is supported.              |
163 164
| callback | AsyncCallback\<string> | Yes  | Callback used to return a successful result or error information.|

165
## innerBundleManager.off<sup>(deprecated)</sup>
166

167
off(type:"BundleStatusChange") : Promise&lt;string&gt;
168 169

Deregisters the callback that receives bundle status changes. This API uses a promise to return the result.
170
> This API is deprecated since API version 9. You are advised to use [bundleMonitor#off](js-apis-bundleMonitor.md) instead.
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185

**Required permissions**

ohos.permission.LISTEN_BUNDLE_CHANGE

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

G
Gloria 已提交
186
| Name| Type  | Mandatory| Description                                      |
187 188
| ------ | ------ | ---- | ------------------------------------------ |
| type   | string | Yes  | Event type. Only **BundleStatusChange** is supported.|
189 190 191 192 193 194 195

**Return value**

| Type           | Description                               |
| --------------- | ----------------------------------- |
| Promise\<string> | Promise used to return a successful result or error information.|

196
## innerBundleManager.getAllLauncherAbilityInfos<sup>(deprecated)</sup>
197 198 199 200

getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback&lt;Array&lt;LauncherAbilityInfo&gt;&gt;) : void;

Obtains the information about all launcher abilities. This API uses an asynchronous callback to return the result.
201
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead.
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

217
| Name  | Type                                                        | Mandatory| Description                                                 |
218
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- |
219
| userId   | number                                                       | Yes  | User ID. The value must be greater than or equal to 0.|
220 221
| callback | AsyncCallback\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Yes  | Callback used to return an array of the launcher ability information.           |

222
## innerBundleManager.getAllLauncherAbilityInfos<sup>(deprecated)</sup>
223 224 225 226

getAllLauncherAbilityInfos(userId: number) : Promise&lt;Array&lt;LauncherAbilityInfo&gt;&gt;

Obtains the information about all launcher abilities. This API uses a promise to return the result.
227
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getAllLauncherAbilityInfo](js-apis-launcherBundleManager.md) instead.
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

243
| Name| Type  | Mandatory| Description                                                 |
244
| ------ | ------ | ---- | ----------------------------------------------------- |
245
| userId | number | Yes  | User ID. The value must be greater than or equal to 0.|
246 247 248 249 250 251 252

**Return value**

| Type                                                        | Description                     |
| ------------------------------------------------------------ | ------------------------- |
| Promise\<Array<[LauncherAbilityInfo](js-apis-bundle-LauncherAbilityInfo.md)>> | Promise used to return an array of the launcher ability information.|

253
## innerBundleManager.getShortcutInfos<sup>(deprecated)</sup>
254 255 256 257

getShortcutInfos(bundleName :string, callback: AsyncCallback&lt;Array&lt;ShortcutInfo&gt;&gt;) : void;

Obtains the shortcut information based on a given bundle name. This API uses an asynchronous callback to return the result.
258
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getShortcutInfo](js-apis-launcherBundleManager.md) instead.
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

274
| Name    | Type                                                        | Mandatory| Description                                          |
275 276 277 278
| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------------------- |
| bundleName | string                                                       | Yes  | Bundle name of an application.                      |
| callback   | AsyncCallback\<Array<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)>> | Yes  | Callback used to return an array of the shortcut information.|

279
## innerBundleManager.getShortcutInfos<sup>(deprecated)</sup>
280 281 282 283

getShortcutInfos(bundleName : string) : Promise&lt;Array&lt;ShortcutInfo&gt;&gt;

Obtains the shortcut information based on a given bundle name. This API uses a promise to return the result.
284
> This API is deprecated since API version 9. You are advised to use [launcherBundleManager#getShortcutInfo](js-apis-launcherBundleManager.md) instead.
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**System API**

This is a system API and cannot be called by third-party applications.

**Parameters**

300
| Name    | Type  | Mandatory| Description                    |
301 302 303 304 305 306 307 308
| ---------- | ------ | ---- | ------------------------ |
| bundleName | string | Yes  | Bundle name of an application.|

**Return value**

| Type                                                    | Description                         |
| -------------------------------------------------------- | ----------------------------- |
| Promise\<Array<[ShortcutInfo](js-apis-bundle-ShortcutInfo.md)>> | Promise used to return an array of the shortcut information.|