js-apis-Bundle.md 64.0 KB
Newer Older
W
wusongqing 已提交
1 2
# Bundle Module (JavaScript SDK APIs)

3
> **NOTE**<br>
W
wusongqing 已提交
4
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
W
wusongqing 已提交
5
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
W
wusongqing 已提交
6 7 8 9 10 11
## Modules to Import

```
import bundle from '@ohos.bundle';
```

W
wusongqing 已提交
12
## System Capability
W
wusongqing 已提交
13 14 15 16 17

SystemCapability.BundleManager.BundleFramework

## Required Permissions

W
wusongqing 已提交
18 19
| Required Permissions                                      | Permission Level        | Description       |
| ---------------------------------------- | ------------ | --------- |
W
wusongqing 已提交
20 21
| ohos.permission.GET_BUNDLE_INFO          | normal       | Permission to query information about the current application.|
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
W
wusongqing 已提交
22
| ohos.permission.INSTALL_BUNDLE           | system_core  | Permission to install or uninstall applications. |
W
wusongqing 已提交
23 24 25

## bundle.getApplicationInfo

W
wusongqing 已提交
26
getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo>
W
wusongqing 已提交
27

W
wusongqing 已提交
28
Obtains the application information based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
29

W
wusongqing 已提交
30
**Required permissions**
W
wusongqing 已提交
31

W
wusongqing 已提交
32 33 34 35 36
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
37 38 39

**Parameters**

W
wusongqing 已提交
40
| Name         | Type    | Mandatory  | Description                                     |
W
wusongqing 已提交
41
| ----------- | ------ | ---- | --------------------------------------- |
W
wusongqing 已提交
42 43 44
| bundleName  | string | Yes   | Bundle name of the application.                           |
| bundleFlags | number | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| 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.           |
W
wusongqing 已提交
45 46 47

**Return value**

W
wusongqing 已提交
48 49
| Type                       | Description                |
| ------------------------- | ------------------ |
W
wusongqing 已提交
50
| Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.|
W
wusongqing 已提交
51 52 53 54

**Example**

```js
W
wusongqing 已提交
55 56 57 58 59 60 61 62
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
bundle.getApplicationInfo(bundleName, bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
63 64 65 66 67 68 69 70 71
})
```



## bundle.getApplicationInfo

getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void

W
wusongqing 已提交
72
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
73

W
wusongqing 已提交
74
**Required permissions**
W
wusongqing 已提交
75

W
wusongqing 已提交
76 77 78 79 80
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
81 82 83

**Parameters**

W
wusongqing 已提交
84 85 86
| Name         | Type                             | Mandatory  | Description                                     |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName  | string                          | Yes   | Bundle name of the application.                           |
W
wusongqing 已提交
87
| bundleFlags | number                          | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
88
| userId      | number                          | Yes   | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.           |
W
wusongqing 已提交
89
| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes   | Callback used to return the application information.                |
W
wusongqing 已提交
90 91 92 93

**Example**

```js
W
wusongqing 已提交
94 95 96 97 98 99 100 101 102 103
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
let userId = 100;
bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
W
wusongqing 已提交
104 105 106
```


W
wusongqing 已提交
107 108 109 110
## bundle.getApplicationInfo

getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void

W
wusongqing 已提交
111
Obtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
112 113 114 115 116 117 118 119 120 121 122

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
123 124 125
| Name         | Type                             | Mandatory  | Description                                     |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
| bundleName  | string                          | Yes   | Bundle name of the application.                           |
W
wusongqing 已提交
126 127
| bundleFlags | number                          | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes   | Callback used to return the application information.                |
W
wusongqing 已提交
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 0;
bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
```

W
wusongqing 已提交
143 144 145

## bundle.getAllBundleInfo

W
wusongqing 已提交
146
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise<Array\<BundleInfo>>
W
wusongqing 已提交
147

W
wusongqing 已提交
148
Obtains the information of all available bundles of a specified user in the system. This API uses a promise to return the result.
W
wusongqing 已提交
149

W
wusongqing 已提交
150
**Required permissions**
W
wusongqing 已提交
151

W
wusongqing 已提交
152 153 154 155 156
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
157 158 159

**Parameters**

W
wusongqing 已提交
160 161
| Name        | Type        | Mandatory  | Description                                     |
| ---------- | ---------- | ---- | --------------------------------------- |
W
wusongqing 已提交
162
| bundleFlag | BundleFlag | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
163
| 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.           |
W
wusongqing 已提交
164 165 166

**Return value**

W
wusongqing 已提交
167 168
| Type                         | Description                        |
| --------------------------- | -------------------------- |
W
wusongqing 已提交
169
| Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all available bundles.|
W
wusongqing 已提交
170 171 172 173

**Example**

```js
W
wusongqing 已提交
174 175 176 177 178 179 180
let bundleFlag = 0;
let userId = 100;
bundle.getAllBundleInfo(bundleFlag, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
181 182 183 184 185 186 187 188 189
})
```



## bundle.getAllBundleInfo

getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback<Array\<BundleInfo>>): void

W
wusongqing 已提交
190
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
191

W
wusongqing 已提交
192
**Required permissions**
W
wusongqing 已提交
193

W
wusongqing 已提交
194 195 196 197 198
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
199 200 201

**Parameters**

W
wusongqing 已提交
202 203
| Name        | Type                               | Mandatory  | Description                                     |
| ---------- | --------------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
204 205
| bundleFlag | BundleFlag                        | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes   | Callback used to return the information of all available bundles.       |
W
wusongqing 已提交
206 207 208 209

**Example**

```js
W
wusongqing 已提交
210 211 212 213 214 215 216 217 218
let bundleFlag = 0;
bundle.getAllBundleInfo(bundleFlag, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
```
W
wusongqing 已提交
219

W
wusongqing 已提交
220 221 222 223 224

## bundle.getAllBundleInfo

getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback<Array\<BundleInfo>>): void

W
wusongqing 已提交
225
Obtains the information of all available bundles in the system. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
226 227 228

**Required permissions**

W
wusongqing 已提交
229 230 231 232 233
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
234 235 236

**Parameters**

W
wusongqing 已提交
237 238
| Name        | Type                               | Mandatory  | Description                                     |
| ---------- | --------------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
239
| bundleFlag | BundleFlag                        | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
240
| userId     | number                            | Yes   | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.           |
W
wusongqing 已提交
241
| callback   | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes   | Callback used to return the information of all available bundles.       |
W
wusongqing 已提交
242 243 244 245 246 247 248 249 250 251 252 253 254

**Example**

```js
let bundleFlag = 0;
let userId = 100;
bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
 })
W
wusongqing 已提交
255 256 257 258 259 260
```



## bundle.getBundleInfo

W
wusongqing 已提交
261
getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>
W
wusongqing 已提交
262

W
wusongqing 已提交
263
Obtains the bundle information based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
264

W
wusongqing 已提交
265
**Required permissions**
W
wusongqing 已提交
266

W
wusongqing 已提交
267 268 269 270 271
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
272 273 274

**Parameters**

W
wusongqing 已提交
275 276
| Name         | Type           | Mandatory  | Description                                     |
| ----------- | ------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
277 278 279
| bundleName  | string        | Yes   | Bundle name of the application.                                     |
| bundleFlags | number        | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options     | [BundleOptions](#bundleoptions) | No   | Includes **userId**.                              |
W
wusongqing 已提交
280 281 282

**Return value**

W
wusongqing 已提交
283 284
| Type                  | Description                          |
| -------------------- | ---------------------------- |
W
wusongqing 已提交
285
| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.|
W
wusongqing 已提交
286 287 288 289

**Example**

```js
W
wusongqing 已提交
290 291 292
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
293
  "userId" : 100
W
wusongqing 已提交
294 295 296 297 298 299
};
bundle.getBundleInfo(bundleName, bundleFlags, options)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
300 301 302 303 304 305 306 307 308
})
```



## bundle.getBundleInfo

getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void

W
wusongqing 已提交
309
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
310

W
wusongqing 已提交
311
**Required permissions**
W
wusongqing 已提交
312

W
wusongqing 已提交
313 314 315 316 317
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
318 319 320

**Parameters**

W
wusongqing 已提交
321 322
| Name         | Type                        | Mandatory  | Description                                     |
| ----------- | -------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
323 324 325
| bundleName  | string                     | Yes   | Bundle name of the application.                                     |
| bundleFlags | number                     | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the bundle information.                   |
W
wusongqing 已提交
326 327 328 329

**Example**

```js
W
wusongqing 已提交
330 331 332 333 334 335 336 337 338
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
339 340 341
```


W
wusongqing 已提交
342 343 344 345
## bundle.getBundleInfo

getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void

W
wusongqing 已提交
346
Obtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
347 348 349

**Required permissions**

W
wusongqing 已提交
350 351 352 353 354
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
355 356 357

**Parameters**

W
wusongqing 已提交
358 359
| Name         | Type                        | Mandatory  | Description                                     |
| ----------- | -------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
360 361 362 363
| bundleName  | string                     | Yes   | Bundle name of the application.                                     |
| bundleFlags | number                     | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options     | [BundleOptions](#bundleoptions)              | Yes   | Includes **userId**.                              |
| callback    | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes   | Callback used to return the bundle information.                   |
W
wusongqing 已提交
364 365 366 367 368 369 370

**Example**

```js
let bundleName = "com.example.myapplication";
let bundleFlags = 1;
let options = {
W
wusongqing 已提交
371
  "userId" : 100
W
wusongqing 已提交
372 373 374 375 376 377 378 379 380 381
};
bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

W
wusongqing 已提交
382 383 384

## bundle.getAllApplicationInfo

W
wusongqing 已提交
385
getAllApplicationInfo(bundleFlags: number, userId?: number): Promise<Array\<ApplicationInfo>>
W
wusongqing 已提交
386

W
wusongqing 已提交
387
Obtains the information about all applications of the specified user. This API uses a promise to return the result.
W
wusongqing 已提交
388

W
wusongqing 已提交
389
**Required permissions**
W
wusongqing 已提交
390

W
wusongqing 已提交
391 392 393 394 395
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
396 397 398

**Parameters**

W
wusongqing 已提交
399 400
| Name         | Type    | Mandatory  | Description                                     |
| ----------- | ------ | ---- | --------------------------------------- |
W
wusongqing 已提交
401
| bundleFlags | number | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
402
| 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.           |
W
wusongqing 已提交
403 404 405

**Return value**

W
wusongqing 已提交
406 407
| Type                              | Description                             |
| -------------------------------- | ------------------------------- |
W
wusongqing 已提交
408
| Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.|
W
wusongqing 已提交
409 410 411 412

**Example**

```js
W
wusongqing 已提交
413 414 415 416 417 418 419
let bundleFlags = 8;
let userId = 100;
bundle.getAllApplicationInfo(bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
420 421 422 423 424 425 426 427 428
})
```



## bundle.getAllApplicationInfo

getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback<Array\<ApplicationInfo>>): void

W
wusongqing 已提交
429
Obtains the information about all applications of the specified user. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
430

W
wusongqing 已提交
431
**Required permissions**
W
wusongqing 已提交
432

W
wusongqing 已提交
433 434 435 436 437
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
438 439 440

**Parameters**

W
wusongqing 已提交
441 442
| Name         | Type                                    | Mandatory  | Description                                     |
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
443
| bundleFlags | number                                 | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
444
| 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.           |
W
wusongqing 已提交
445
| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes   | Callback used to return the application information.                |
W
wusongqing 已提交
446 447 448 449

**Example**

```js
W
wusongqing 已提交
450 451 452 453 454 455 456 457 458
let bundleFlags = 8;
let userId = 100;
bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
459 460 461
```


W
wusongqing 已提交
462 463
## bundle.getAllApplicationInfo

W
wusongqing 已提交
464
getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback<Array\<ApplicationInfo>>) : void;
W
wusongqing 已提交
465

W
wusongqing 已提交
466
Obtains the information about all applications. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
467 468 469 470 471 472 473 474 475 476 477

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
478 479
| Name         | Type                                    | Mandatory  | Description                                     |
| ----------- | -------------------------------------- | ---- | --------------------------------------- |
W
wusongqing 已提交
480 481
| bundleFlags | number                                 | Yes   | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes   | Callback used to return the application information.                |
W
wusongqing 已提交
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499

**Example**

```js
let bundleFlags = 8;
bundle.getAllApplicationInfo(bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

## bundle.getAbilityInfo

getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>

W
wusongqing 已提交
500
Obtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
501 502 503 504 505 506 507 508 509 510 511

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
512 513 514
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
W
wusongqing 已提交
515
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
516 517 518

**Return value**

W
wusongqing 已提交
519 520
| Type                   | Description                   |
| --------------------- | --------------------- |
W
wusongqing 已提交
521
| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|
W
wusongqing 已提交
522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityInfo

W
wusongqing 已提交
538
getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;
W
wusongqing 已提交
539

W
wusongqing 已提交
540
Obtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
541 542 543 544 545 546 547 548 549 550 551

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
552 553 554
| Name        | Type    | Mandatory  | Description           |
| ----------- | ------------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
W
wusongqing 已提交
555 556
| abilityName | string | Yes   | Ability name.|
| callback    | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes   | Callback used to return the ability information.|
W
wusongqing 已提交
557 558 559 560 561 562 563 564 565 566 567 568 569 570

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649
## bundle.getAbilityInfo<sup>9+</sup>

getAbilityInfo(bundleName: string, moduleName: string, abilityName: string): Promise\<AbilityInfo>

Obtains the ability information based on a given bundle name, module name, and ability name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|

**Return value**

| Type                   | Description                   |
| --------------------- | --------------------- |
| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityInfo<sup>9+</sup>

getAbilityInfo(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;

Obtains the ability information based on a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name        | Type    | Mandatory  | Description           |
| ----------- | ------------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|
| callback    | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes   | Callback used to return the ability information.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
650

W
wusongqing 已提交
651
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
652 653 654

getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>

W
wusongqing 已提交
655
Obtains the application name based on a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
656 657 658 659 660 661 662 663 664 665 666

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
667 668 669
| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
W
wusongqing 已提交
670
| abilityName | string | Yes   | Ability name.|
W
wusongqing 已提交
671 672 673

**Return value**

W
wusongqing 已提交
674 675
| Type              | Description                |
| ---------------- | ------------------ |
W
wusongqing 已提交
676
| Promise\<string> | Promise used to return the application name.|
W
wusongqing 已提交
677 678 679 680 681 682 683 684 685 686 687 688 689 690

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
691
## bundle.getAbilityLabel<sup>8+</sup>
W
wusongqing 已提交
692 693 694

getAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void

W
wusongqing 已提交
695
Obtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
696 697 698 699 700 701 702 703 704 705 706

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
707 708 709
| Name         | Type                    | Mandatory  | Description              |
| ----------- | ---------------------- | ---- | ---------------- |
| bundleName  | string                 | Yes   | Bundle name of the application.    |
W
wusongqing 已提交
710
| abilityName | string                 | Yes   | Ability name.|
W
wusongqing 已提交
711
| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |
W
wusongqing 已提交
712 713 714 715 716 717 718 719 720 721 722 723 724 725

**Example**

```js
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804
## bundle.getAbilityLabel<sup>9+</sup>

getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise\<string>

Obtains the application name based on a given bundle name, module name, and ability name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type    | Mandatory  | Description              |
| ----------- | ------ | ---- | ---------------- |
| bundleName  | string | Yes   | Bundle name of the application.    |
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string | Yes   | Ability name.|

**Return value**

| Type              | Description                |
| ---------------- | ------------------ |
| Promise\<string> | Promise used to return the application name.|

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityLabel<sup>9+</sup>

getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback : AsyncCallback\<string>): void

Obtains the application name based on a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                    | Mandatory  | Description              |
| ----------- | ---------------------- | ---- | ---------------- |
| bundleName  | string                 | Yes   | Bundle name of the application.    |
| moduleName  | string | Yes   | Module name of the application.    |
| abilityName | string                 | Yes   | Ability name.|
| callback    | AsyncCallback\<string> | Yes   | Callback used to return the application name.       |

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityLabel(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
805

W
wusongqing 已提交
806
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
807 808 809

isAbilityEnabled(info: AbilityInfo): Promise\<boolean>

W
wusongqing 已提交
810
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result.
W
wusongqing 已提交
811 812 813 814 815 816 817 818 819 820 821

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
822 823
| Name  | Type         | Mandatory  | Description          |
| ---- | ----------- | ---- | ------------ |
W
wusongqing 已提交
824
| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes   | Ability information.|
W
wusongqing 已提交
825 826 827

**Return value**

W
wusongqing 已提交
828 829
| Type               | Description                       |
| ----------------- | ------------------------- |
W
wusongqing 已提交
830
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
831 832 833 834

**Example**

```js
W
wusongqing 已提交
835 836 837 838 839 840 841 842
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{
    bundle.isAbilityEnabled(abilityInfo).then((data) => {
        console.info('Operation successful. Data: ' + JSON.stringify(data));
    }).catch((error) => {
        console.error('Operation failed. Cause: ' + JSON.stringify(error));
    })
W
wusongqing 已提交
843 844 845
})
```

W
wusongqing 已提交
846
## bundle.isAbilityEnabled<sup>8+</sup>
W
wusongqing 已提交
847 848 849

isAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void

W
wusongqing 已提交
850
Checks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
851 852 853 854 855 856 857 858 859 860 861

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
862 863
| Name      | Type                     | Mandatory  | Description             |
| -------- | ----------------------- | ---- | --------------- |
W
wusongqing 已提交
864 865
| info     | [AbilityInfo](js-apis-bundle-AbilityInfo.md)             | Yes   | Ability information.   |
| callback | AsyncCallback\<boolean> | Yes   | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
866 867 868 869

**Example**

```js
W
wusongqing 已提交
870 871 872 873
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo)=>{
    bundle.isAbilityEnabled(abilityInfo, (err, data) => {
W
wusongqing 已提交
874 875 876 877 878
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
W
wusongqing 已提交
879
    })
W
wusongqing 已提交
880 881 882
})
```

W
wusongqing 已提交
883
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
884 885 886

isApplicationEnabled(bundleName: string): Promise\<boolean>

W
wusongqing 已提交
887
Checks whether an application is enabled based on a given bundle name. This API uses a promise to return the result.
W
wusongqing 已提交
888 889 890 891 892 893 894 895 896 897 898

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
899 900
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
W
wusongqing 已提交
901
| bundleName | string | Yes   | Bundle name of the application.|
W
wusongqing 已提交
902 903 904

**Return value**

W
wusongqing 已提交
905 906
| Type               | Description                       |
| ----------------- | ------------------------- |
W
wusongqing 已提交
907
| Promise\<boolean> | Promise used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
908 909 910 911 912 913 914 915 916 917 918 919 920

**Example**

```js
let bundleName = "com.example.myapplication";
bundle.isApplicationEnabled(bundleName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
921
## bundle.isApplicationEnabled<sup>8+</sup>
W
wusongqing 已提交
922 923 924

isApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void

W
wusongqing 已提交
925
Checks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
926 927 928 929 930 931 932 933 934 935 936

**Required permissions**

None

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
937 938 939
| Name        | Type                     | Mandatory  | Description             |
| ---------- | ----------------------- | ---- | --------------- |
| bundleName | string                  | Yes   | Bundle name of the application.   |
W
wusongqing 已提交
940
| callback   | AsyncCallback\<boolean> | Yes   | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
W
wusongqing 已提交
941 942 943 944

**Example**

```js
W
wusongqing 已提交
945
let bundleName = "com.example.myapplication";
W
wusongqing 已提交
946 947 948 949 950 951 952 953
bundle.isApplicationEnabled(bundleName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
954 955 956 957 958

## bundle.queryAbilityByWant

queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise<Array\<AbilityInfo>>

W
wusongqing 已提交
959
Obtains the ability information based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
960

W
wusongqing 已提交
961
**Required permissions**
W
wusongqing 已提交
962

W
wusongqing 已提交
963 964 965 966 967
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
968 969 970

**Parameters**

W
wusongqing 已提交
971 972
| Name         | Type    | Mandatory  | Description                                   |
| ----------- | ------ | ---- | ------------------------------------- |
W
wusongqing 已提交
973 974
| want        | [Want](js-apis-application-Want.md)   | Yes   | Want that contains the bundle name.                    |
| bundleFlags | number | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
975
| 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.          |
W
wusongqing 已提交
976 977 978

**Return value**

W
wusongqing 已提交
979 980
| Type                          | Description                   |
| ---------------------------- | --------------------- |
W
wusongqing 已提交
981
| Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.|
W
wusongqing 已提交
982 983 984 985

**Example**

```js
W
wusongqing 已提交
986 987 988 989 990 991 992 993 994 995 996
let bundleFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, userId)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
W
wusongqing 已提交
997 998 999 1000 1001 1002 1003 1004 1005
})
```



## bundle.queryAbilityByWant

queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void

W
wusongqing 已提交
1006
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1007 1008 1009 1010

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1011 1012 1013

**Parameters**

W
wusongqing 已提交
1014 1015
| Name         | Type                                | Mandatory  | Description                                   |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
W
wusongqing 已提交
1016 1017
| want        | [Want](js-apis-application-Want.md)                               | Yes   | Want that contains the bundle name.                  |
| bundleFlags | number                             | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
W
wusongqing 已提交
1018
| userId      | number                             | Yes   | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.          |
W
wusongqing 已提交
1019
| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes   | Callback used to return the ability information.           |
W
wusongqing 已提交
1020 1021 1022 1023

**Example**

```js
W
wusongqing 已提交
1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036
let bundleFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1037 1038 1039 1040
```

## bundle.queryAbilityByWant

W
wusongqing 已提交
1041
queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback<Array\<AbilityInfo>>): void;
W
wusongqing 已提交
1042

W
wusongqing 已提交
1043
Obtains the ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1044

W
wusongqing 已提交
1045 1046 1047 1048
**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1049 1050
**Parameters**

W
wusongqing 已提交
1051 1052
| Name         | Type                                | Mandatory  | Description                                   |
| ----------- | ---------------------------------- | ---- | ------------------------------------- |
W
wusongqing 已提交
1053 1054 1055
| want        | [Want](js-apis-application-Want.md)                               | Yes   | Want that contains the bundle name.                  |
| bundleFlags | number                             | Yes   | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback    | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes   | Callback used to return the ability information.           |
W
wusongqing 已提交
1056 1057 1058 1059

**Example**

```js
W
wusongqing 已提交
1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070
let bundleFlags = 0;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
W
wusongqing 已提交
1071 1072 1073 1074 1075
})
```



W
wusongqing 已提交
1076 1077 1078 1079
## bundle.getLaunchWantForBundle

getLaunchWantForBundle(bundleName: string): Promise\<Want>

W
wusongqing 已提交
1080
Obtains the **Want** object that launches the specified application. This API uses a promise to return the result.
W
wusongqing 已提交
1081

W
wusongqing 已提交
1082 1083
**Required permissions**

W
wusongqing 已提交
1084 1085 1086 1087 1088
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1089 1090 1091

**Parameters**

W
wusongqing 已提交
1092 1093
| Name        | Type    | Mandatory  | Description          |
| ---------- | ------ | ---- | ------------ |
W
wusongqing 已提交
1094
| bundleName | string | Yes   | Bundle name of the application.|
W
wusongqing 已提交
1095 1096

**Return value**
W
wusongqing 已提交
1097 1098
| Type            | Description                                    |
| -------------- | -------------------------------------- |
W
wusongqing 已提交
1099
| Promise\<[Want](js-apis-application-Want.md)> | Promise used to return the **Want** object.|
W
wusongqing 已提交
1100 1101 1102 1103

**Example**

```js
W
wusongqing 已提交
1104 1105 1106 1107 1108 1109 1110
let bundleName = "com.example.myapplication";
bundle.getLaunchWantForBundle(bundleName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
W
wusongqing 已提交
1111 1112
```

W
wusongqing 已提交
1113
## bundle.getLaunchWantForBundle
W
wusongqing 已提交
1114

W
wusongqing 已提交
1115
getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;
W
wusongqing 已提交
1116

W
wusongqing 已提交
1117
Obtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1118

W
wusongqing 已提交
1119
**Required permissions**
W
wusongqing 已提交
1120

W
wusongqing 已提交
1121 1122 1123 1124 1125
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1126 1127 1128

**Parameters**

W
wusongqing 已提交
1129 1130 1131
| Name        | Type                  | Mandatory  | Description                            |
| ---------- | -------------------- | ---- | ------------------------------ |
| bundleName | string               | Yes   | Bundle name of the application.                  |
W
wusongqing 已提交
1132
| callback   | AsyncCallback\<[Want](js-apis-application-Want.md)> | Yes   | Callback used to return the **Want** object.|
W
wusongqing 已提交
1133 1134 1135 1136

**Example**

```js
W
wusongqing 已提交
1137 1138 1139 1140 1141 1142 1143 1144
let bundleName = "com.example.myapplication";
bundle.getLaunchWantForBundle(bundleName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1145 1146 1147
```


W
wusongqing 已提交
1148
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1149 1150

getNameForUid(uid: number): Promise\<string>
W
wusongqing 已提交
1151

W
wusongqing 已提交
1152
Obtains the bundle name based on a UID. This API uses a promise to return the result.
W
wusongqing 已提交
1153 1154 1155 1156

**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1157 1158 1159

**Parameters**

W
wusongqing 已提交
1160 1161
| Name  | Type    | Mandatory  | Description      |
| ---- | ------ | ---- | -------- |
W
wusongqing 已提交
1162
| uid  | number | Yes   | UID based on which the bundle name is to obtain.|
W
wusongqing 已提交
1163 1164

**Return value**
W
wusongqing 已提交
1165 1166
| Type              | Description                               |
| ---------------- | --------------------------------- |
W
wusongqing 已提交
1167
| Promise\<string> | Promise used to return the bundle name.|
W
wusongqing 已提交
1168 1169 1170 1171

**Example**

```js
W
wusongqing 已提交
1172 1173 1174 1175 1176 1177 1178
let uid = 20010005;
bundle.getNameForUid(uid)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
W
wusongqing 已提交
1179 1180
```

W
wusongqing 已提交
1181
## bundle.getNameForUid<sup>8+</sup>
W
wusongqing 已提交
1182

W
wusongqing 已提交
1183
getNameForUid(uid: number, callback: AsyncCallback\<string>) : void
W
wusongqing 已提交
1184

W
wusongqing 已提交
1185
Obtains the bundle name based on a UID. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1186

W
wusongqing 已提交
1187 1188 1189
**System capability**

SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1190 1191 1192

**Parameters**

W
wusongqing 已提交
1193 1194 1195
| Name      | Type                    | Mandatory  | Description                       |
| -------- | ---------------------- | ---- | ------------------------- |
| uid      | number                 | Yes   | UID based on which the bundle name is to obtain.                 |
W
wusongqing 已提交
1196
| callback | AsyncCallback\<string> | Yes   | Callback used to return the bundle name.|
W
wusongqing 已提交
1197 1198 1199 1200

**Example**

```js
W
wusongqing 已提交
1201 1202 1203 1204 1205 1206 1207 1208
let uid = 20010005;
bundle.getNameForUid(uid, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
W
wusongqing 已提交
1209 1210
```

W
wusongqing 已提交
1211

W
wusongqing 已提交
1212
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1213

W
wusongqing 已提交
1214
getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;
W
wusongqing 已提交
1215

W
wusongqing 已提交
1216
Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result.
W
wusongqing 已提交
1217

W
wusongqing 已提交
1218 1219 1220 1221 1222 1223 1224 1225
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1226 1227
**Parameters**

W
wusongqing 已提交
1228 1229 1230 1231
| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
W
wusongqing 已提交
1232 1233 1234 1235

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
W
wusongqing 已提交
1236
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). |
W
wusongqing 已提交
1237 1238 1239 1240

**Example**

```js
W
wusongqing 已提交
1241 1242
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
W
wusongqing 已提交
1243 1244 1245 1246 1247 1248 1249 1250
bundle.getAbilityIcon(bundleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

W
wusongqing 已提交
1251
## bundle.getAbilityIcon<sup>8+</sup>
W
wusongqing 已提交
1252

W
wusongqing 已提交
1253
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;
W
wusongqing 已提交
1254

W
wusongqing 已提交
1255
Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1256

W
wusongqing 已提交
1257 1258 1259 1260 1261 1262 1263 1264
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1265 1266
**Parameters**

W
wusongqing 已提交
1267 1268 1269 1270
| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
W
wusongqing 已提交
1271
| callback   | AsyncCallback\<image.PixelMap> | Yes  | Callback used to return the [PixelMap](js-apis-image.md). |
W
wusongqing 已提交
1272 1273 1274 1275

**Example**

```js
W
wusongqing 已提交
1276 1277
let bundleName = "com.example.myapplication";
let abilityName = "com.example.myapplication.MainAbility";
W
wusongqing 已提交
1278 1279 1280 1281 1282 1283 1284 1285 1286
bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```

W
wusongqing 已提交
1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364
## bundle.getAbilityIcon<sup>9+</sup>

getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise\<image.PixelMap>;

Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses a promise to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| moduleName  | string                                   | Yes   | Module name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |

**Return value**
| Type                 | Description                                                        |
| --------------------- | ------------------------------------------------------------ |
| Promise\<image.PixelMap> | Promise used to return the [PixelMap](js-apis-image.md). |

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityIcon(bundleName, moduleName, abilityName)
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```

## bundle.getAbilityIcon<sup>9+</sup>

getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;

Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

| Name         | Type                                      | Mandatory  | Description                                      |
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName  | string                                   | Yes   | Bundle name based on which the pixel map is to obtain.                         |
| moduleName  | string                                   | Yes   | Module name based on which the pixel map is to obtain.                         |
| abilityName | string                                   | Yes   | Ability name based on which the pixel map is to obtain.                        |
| callback   | AsyncCallback\<image.PixelMap> | Yes  | Callback used to return the [PixelMap](js-apis-image.md). |

**Example**

```js
let bundleName = "com.example.myapplication";
let moduleName = "entry";
let abilityName = "com.example.myapplication.MainAbility";
bundle.getAbilityIcon(bundleName, moduleName, abilityName, (err, data) => {
    if (err) {
        console.error('Operation failed. Cause: ' + JSON.stringify(err));
        return;
    }
    console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
W
wusongqing 已提交
1365

W
wusongqing 已提交
1366
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
1367

W
wusongqing 已提交
1368
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId?: number): Promise<Array\<ExtensionAbilityInfo>>
W
wusongqing 已提交
1369

W
wusongqing 已提交
1370
Obtains the Extension ability information based on a given want. This API uses a promise to return the result.
W
wusongqing 已提交
1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381

**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1382 1383
| Name            | Type    | Mandatory  | Description                                      |
| -------------- | ------ | ---- | ---------------------------------------- |
W
wusongqing 已提交
1384 1385 1386
| want           | [Want](js-apis-application-Want.md)   | Yes   | Want that contains the bundle name.                       |
| extensionType  | number | Yes   | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#ExtensionAbilityType9).|
| extensionFlags | number | Yes   | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#ExtensionFlag9).|
W
wusongqing 已提交
1387
| 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.             |
W
wusongqing 已提交
1388 1389 1390

**Return value**

W
wusongqing 已提交
1391 1392
| Type                                   | Description                            |
| ------------------------------------- | ------------------------------ |
W
wusongqing 已提交
1393
| Promise<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Promise used to return the Extension ability information.|
W
wusongqing 已提交
1394 1395 1396 1397

**Example**

```js
W
wusongqing 已提交
1398
let extensionType = 0;
W
wusongqing 已提交
1399 1400 1401 1402 1403 1404
let extensionFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
1405
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId)
W
wusongqing 已提交
1406 1407 1408 1409 1410 1411 1412 1413 1414
.then((data) => {
    console.info('Operation successful. Data: ' + JSON.stringify(data));
}).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```



W
wusongqing 已提交
1415
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
1416

W
wusongqing 已提交
1417
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, userId: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void
W
wusongqing 已提交
1418

W
wusongqing 已提交
1419
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1420

W
wusongqing 已提交
1421 1422 1423 1424
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1425 1426 1427 1428 1429 1430
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1431 1432 1433 1434 1435 1436 1437
| Name          | Type                                                        | Mandatory| Description                                                        |
| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| want           | [Want](js-apis-application-Want.md)                                                        | Yes  | Want that contains the bundle name.                      |
| extensionType  | number                                                       | Yes  | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#ExtensionAbilityType9).|
| extensionFlags | number                                                       | Yes  | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#ExtensionFlag9).|
| userId         | number                                                       | Yes  | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.         |
| callback       | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes  | Callback used to return the Extension ability information.      |
W
wusongqing 已提交
1438 1439 1440 1441

**Example**

```js
W
wusongqing 已提交
1442
let extensionType = 0;
W
wusongqing 已提交
1443 1444 1445 1446 1447 1448
let extensionFlags = 0;
let userId = 100;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
1449 1450 1451 1452 1453 1454 1455
const receiver = function onReceive(err, data) {
    var errValue = JSON.stringify(err)
    var dataValue = JSON.stringify(data)
    console.error('Operation failed. Cause: ' + errValue);
    console.error('Operation failed. Cause: ' + dataValue);
}
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, userId, receiver)
W
wusongqing 已提交
1456 1457
```

W
wusongqing 已提交
1458
## bundle.queryExtensionAbilityInfos<sup>9+</sup>
W
wusongqing 已提交
1459

W
wusongqing 已提交
1460
queryExtensionAbilityInfos(want: Want, extensionType: number, extensionFlags: number, callback: AsyncCallback<Array\<ExtensionAbilityInfo>>): void;
W
wusongqing 已提交
1461

W
wusongqing 已提交
1462
Obtains the Extension ability information based on a given want. This API uses an asynchronous callback to return the result.
W
wusongqing 已提交
1463

W
wusongqing 已提交
1464 1465 1466 1467
**Required permissions**

ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO

W
wusongqing 已提交
1468 1469 1470 1471 1472 1473
**System capability**

SystemCapability.BundleManager.BundleFramework

**Parameters**

W
wusongqing 已提交
1474 1475
| Name            | Type                                      | Mandatory  | Description                                      |
| -------------- | ---------------------------------------- | ---- | ---------------------------------------- |
W
wusongqing 已提交
1476 1477 1478 1479
| want           | [Want](js-apis-application-Want.md)                                     | Yes   | Want that contains the bundle name.                     |
| extensionType  | number                                   | Yes   | Type of the Extension ability information to obtain. The default value is **0**. For details on the available enumerated values, see [ExtensionAbilityType](#ExtensionAbilityType9).|
| extensionFlags | number                                   | Yes   | Extension ability information to be returned. The default value is **0**. For details on the available enumerated values, see [ExtensionFlags](#ExtensionFlag9).|
| callback       | AsyncCallback<Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)>> | Yes   | Callback used to return the Extension ability information.     |
W
wusongqing 已提交
1480 1481 1482 1483

**Example**

```js
W
wusongqing 已提交
1484
let extensionType = 0;
W
wusongqing 已提交
1485 1486 1487 1488 1489
let extensionFlags = 0;
let want = {
    bundleName : "com.example.myapplication",
    abilityName : "com.example.myapplication.MainAbility"
};
W
wusongqing 已提交
1490 1491 1492 1493 1494 1495 1496
const receiver = function onReceive(err, data) {
    var errValue = JSON.stringify(err)
    var dataValue = JSON.stringify(data)
    console.error('Operation failed. Cause: ' + errValue);
    console.error('Operation failed. Cause: ' + dataValue);
}
bundle.queryExtensionAbilityInfos(want, extensionType, extensionFlags, receiver)
W
wusongqing 已提交
1497 1498
```

W
wusongqing 已提交
1499
## InstallErrorCode
W
wusongqing 已提交
1500

W
wusongqing 已提交
1501 1502
 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1503 1504 1505
| Name                                      | Default Value | Description                       |
| ---------------------------------------- | ---- | ------------------------- |
| SUCCESS                                  | 0    | Installation succeeded.                     |
W
wusongqing 已提交
1506
| STATUS_INSTALL_FAILURE                   | 1    | Installation failed. (The application to be installed is not found.)           |
W
wusongqing 已提交
1507 1508
| STATUS_INSTALL_FAILURE_ABORTED           | 2    | Installation aborted.                     |
| STATUS_INSTALL_FAILURE_INVALID           | 3    | Invalid installation parameter.                   |
W
wusongqing 已提交
1509
| STATUS_INSTALL_FAILURE_CONFLICT          | 4    | Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.) |
W
wusongqing 已提交
1510
| STATUS_INSTALL_FAILURE_STORAGE           | 5    | Failed to store the bundle information.                  |
W
wusongqing 已提交
1511 1512
| STATUS_INSTALL_FAILURE_INCOMPATIBLE      | 6    | Installation incompatibility. (A downgrade occurs or the signature information is incorrect.) |
| STATUS_UNINSTALL_FAILURE                 | 7    | Uninstallation failed. (The application to be uninstalled is not found.)          |
W
wusongqing 已提交
1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524
| STATUS_UNINSTALL_FAILURE_BLOCKED         | 8    | Uninstallation aborted. (This error code is not in use.)              |
| STATUS_UNINSTALL_FAILURE_ABORTED         | 9    | Uninstallation aborted. (Invalid parameters.)            |
| STATUS_UNINSTALL_FAILURE_CONFLICT        | 10   | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)|
| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT  | 0x0B | Installation failed. (Download timed out.)              |
| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED   | 0x0C | Installation failed. (Download failed.)              |
| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application.                 |
| STATUS_ABILITY_NOT_FOUND                 | 0x40 | Ability not found.               |
| STATUS_BMS_SERVICE_ERROR                 | 0x41 | BMS service error.                  |
| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space.                   |
| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed.                   |
| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | Installation permission denied.                   |
| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | Uninstallation permission denied.                   |
W
wusongqing 已提交
1525 1526 1527

## BundleFlag

W
wusongqing 已提交
1528 1529 1530
Enumerates bundle flags.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1531

W
wusongqing 已提交
1532 1533 1534 1535 1536 1537 1538 1539 1540
| Name                                      | Default Value       | Description                 |
| ---------------------------------------- | ---------- | ------------------- |
| GET_BUNDLE_DEFAULT                       | 0x00000000 | Obtains the default application information.          |
| GET_BUNDLE_WITH_ABILITIES                | 0x00000001 | Obtains the bundle information with the ability information.  |
| GET_ABILITY_INFO_WITH_PERMISSION         | 0x00000002 | Obtains the ability information with the permission information.   |
| GET_ABILITY_INFO_WITH_APPLICATION        | 0x00000004 | Obtains the ability information with the application information.   |
| GET_APPLICATION_INFO_WITH_PERMISSION     | 0x00000008 | Obtains the application information with the permission information.        |
| GET_BUNDLE_WITH_REQUESTED_PERMISSION     | 0x00000010 | Obtains the bundle information with the information about the required permissions.       |
| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information.    |
W
wusongqing 已提交
1541
| GET_BUNDLE_WITH_EXTENSION_ABILITY<sup>9+</sup> | 0x00000020 | Obtains the bundle information with the Extension ability information.|
W
wusongqing 已提交
1542
| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information.         |
W
wusongqing 已提交
1543
| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.|
W
wusongqing 已提交
1544 1545 1546
| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities.  |
| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications.       |
| GET_ALL_APPLICATION_INFO                 | 0xFFFF0000 | Obtains all application information.          |
W
wusongqing 已提交
1547 1548 1549 1550 1551

## BundleOptions

Describes the bundle options.

W
wusongqing 已提交
1552 1553
 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1554 1555
| Name    | Type    | Readable  | Writable  | Description                          |
| ------ | ------ | ---- | ---- | ---------------------------- |
W
wusongqing 已提交
1556
| userId | number | Yes   | Yes   | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
W
wusongqing 已提交
1557 1558 1559

## AbilityType

W
wusongqing 已提交
1560 1561 1562
Enumerates ability types.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1563

W
wusongqing 已提交
1564 1565 1566 1567 1568
| Name     | Type  | Description               |
| ------- | ---- | ----------------- |
| UNKNOWN | None   | Unknown ability type.      |
| PAGE    | None   | Ability that has a UI.   |
| SERVICE | None   | Ability that does not have a UI.    |
W
wusongqing 已提交
1569
| DATA    | None   | Ability that is used to provide data access services.|
W
wusongqing 已提交
1570 1571 1572

## DisplayOrientation

W
wusongqing 已提交
1573 1574 1575
Enumerates display orientations.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1576

W
wusongqing 已提交
1577 1578 1579 1580 1581
| Name           | Type  | Description           |
| ------------- | ---- | ------------- |
| UNSPECIFIED   | None   | The system automatically determines the display orientation.    |
| LANDSCAPE     | None   | Landscape orientation.     |
| PORTRAIT      | None   | Portrait orientation.     |
W
wusongqing 已提交
1582
| FOLLOW_RECENT | None   | The page ability orientation is the same as that of the nearest ability in the stack.|
W
wusongqing 已提交
1583 1584 1585

## LaunchMode

W
wusongqing 已提交
1586 1587 1588
Enumerates launch modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1589

W
wusongqing 已提交
1590 1591
| Name       | Type  | Description           |
| --------- | ---- | ------------- |
W
wusongqing 已提交
1592
| SINGLETON | 0    | The ability has only one instance.|
W
wusongqing 已提交
1593
| STANDARD  | 1    | The ability can have multiple instances. |
W
wusongqing 已提交
1594 1595 1596

## AbilitySubType

W
wusongqing 已提交
1597 1598 1599
Enumerates ability subtypes.

 **System capability**: SystemCapability.BundleManager.BundleFramework
W
wusongqing 已提交
1600

W
wusongqing 已提交
1601 1602 1603
| Name         | Type  | Description                  |
| ----------- | ---- | -------------------- |
| UNSPECIFIED | 0    | Undefined ability subtype.       |
W
wusongqing 已提交
1604
| CA          | 1    | Ability that has a UI.|
W
wusongqing 已提交
1605

W
wusongqing 已提交
1606
## ExtensionAbilityType<sup>9+</sup>
W
wusongqing 已提交
1607

W
wusongqing 已提交
1608
Enumerates Extension ability types.
W
wusongqing 已提交
1609 1610 1611

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1612 1613 1614
| Name                            | Type  | Description                       |
| ------------------------------ | ---- | ------------------------- |
| FORM<sup>9+</sup>              | 0    | Form included.  |
W
wusongqing 已提交
1615
| WORK_SCHEDULER<sup>9+</sup>    | 1    | Work scheduler included.|
W
wusongqing 已提交
1616 1617 1618
| INPUT_METHOD<sup>9+</sup>      | 2    | Input method included. |
| SERVICE<sup>9+</sup>           | 3    | Service included.  |
| ACCESSIBILITY<sup>9+</sup>     | 4    | Accessibility included. |
W
wusongqing 已提交
1619 1620
| DATA_SHARE<sup>9+</sup>        | 5    | Data sharing included.|
| FILE_SHARE<sup>9+</sup>        | 6    | File sharing included.|
W
wusongqing 已提交
1621 1622
| STATIC_SUBSCRIBER<sup>9+</sup> | 7    | Subscribers included. |
| WALLPAPER<sup>9+</sup>         | 8    | Wallpaper included.  |
W
wusongqing 已提交
1623 1624
| BACKUP<sup>9+</sup>            | 9    | Data backup and restore included.  |
| UNSPECIFIED<sup>9+</sup>       | 20    | Unspecified type.    |
W
wusongqing 已提交
1625 1626

## ExtensionFlag<sup>9+</sup>
W
wusongqing 已提交
1627

W
wusongqing 已提交
1628
Enumerates Extension flags.
W
wusongqing 已提交
1629 1630 1631

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1632 1633 1634 1635 1636
| Name                                      | Default Value       | Description                            |
| ---------------------------------------- | ---------- | ------------------------------ |
| GET_EXTENSION_INFO_DEFAULT<sup>9+</sup>  | 0x00000000 | Obtains the default Extension ability information.     |
| GET_EXTENSION_INFO_WITH_PERMISSION<sup>9+</sup> | 0x00000002 | Obtains the Extension ability information that carries permission information. |
| GET_EXTENSION_INFO_WITH_APPLICATION<sup>9+</sup> | 0x00000004 | Obtains the Extension ability information that carries application information. |
W
wusongqing 已提交
1637
| GET_EXTENSION_INFO_WITH_METADATA<sup>9+</sup> | 0x00000020 | Obtains the Extension ability information that carries metadata information.|
W
wusongqing 已提交
1638 1639 1640 1641 1642 1643 1644

## ColorMode

Enumerates color modes.

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1645 1646
| Name        | Type  | Description  |
| ---------- | ---- | ---- |
W
wusongqing 已提交
1647 1648 1649
| AUTO_MODE  | -1   | Automatic mode.|
| DARK_MODE  | 0    | Dark mode.|
| LIGHT_MODE | 1    | Light mode.|
W
wusongqing 已提交
1650 1651


W
wusongqing 已提交
1652 1653
## GrantStatus

W
wusongqing 已提交
1654
Enumerates permission grant states.
W
wusongqing 已提交
1655 1656 1657

 **System capability**: SystemCapability.BundleManager.BundleFramework

W
wusongqing 已提交
1658 1659
| Name                | Type  | Description  |
| ------------------ | ---- | ---- |
W
wusongqing 已提交
1660
| PERMISSION_DENIED  | -1   | Permission denied.|
W
wusongqing 已提交
1661
| PERMISSION_GRANTED | 0    | Permission granted.  |