1e41f4b71Sopenharmony_ci# @ohos.bundle (Bundle) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **bundle** module provides APIs for obtaining information about an application, including [bundle information](js-apis-bundle-BundleInfo.md), [application information](js-apis-bundle-ApplicationInfo.md), and [ability information](js-apis-bundle-AbilityInfo.md). It also provides APIs to obtain and set the application disabling state. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 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. 8e41f4b71Sopenharmony_ci> The APIs of this module are deprecated since API version 9. You are advised to use [@ohos.bundle.bundleManager](js-apis-bundleManager.md) instead. 9e41f4b71Sopenharmony_ci## Modules to Import 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci```ts 12e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 13e41f4b71Sopenharmony_ci``` 14e41f4b71Sopenharmony_ci 15e41f4b71Sopenharmony_ci## Required Permissions 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci| Permission | APL | Description | 18e41f4b71Sopenharmony_ci|--------------------------------------------|--------------|---------------| 19e41f4b71Sopenharmony_ci| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified bundle.| 20e41f4b71Sopenharmony_ci| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all bundles. | 21e41f4b71Sopenharmony_ci 22e41f4b71Sopenharmony_ciFor details about the APL, see [Basic Concepts in the Permission Mechanism](../../security/AccessToken/app-permission-mgmt-overview.md#basic-concepts-in-the-permission-mechanism). 23e41f4b71Sopenharmony_ci 24e41f4b71Sopenharmony_ci## bundle.getApplicationInfo<sup>deprecated<sup> 25e41f4b71Sopenharmony_ci 26e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 27e41f4b71Sopenharmony_ci 28e41f4b71Sopenharmony_cigetApplicationInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<ApplicationInfo> 29e41f4b71Sopenharmony_ci 30e41f4b71Sopenharmony_ciObtains the application information based on a given bundle name. This API uses a promise to return the result. 31e41f4b71Sopenharmony_ci 32e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 33e41f4b71Sopenharmony_ci 34e41f4b71Sopenharmony_ci**Required permissions** 35e41f4b71Sopenharmony_ci 36e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 37e41f4b71Sopenharmony_ci 38e41f4b71Sopenharmony_ci**System capability** 39e41f4b71Sopenharmony_ci 40e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 41e41f4b71Sopenharmony_ci 42e41f4b71Sopenharmony_ci**Parameters** 43e41f4b71Sopenharmony_ci 44e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 45e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ------------------------------------------------------------ | 46e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 47e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 48e41f4b71Sopenharmony_ci| 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. | 49e41f4b71Sopenharmony_ci 50e41f4b71Sopenharmony_ci**Return value** 51e41f4b71Sopenharmony_ci 52e41f4b71Sopenharmony_ci| Type | Description | 53e41f4b71Sopenharmony_ci| ------------------------- | ------------------ | 54e41f4b71Sopenharmony_ci| Promise\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Promise used to return the application information.| 55e41f4b71Sopenharmony_ci 56e41f4b71Sopenharmony_ci**Example** 57e41f4b71Sopenharmony_ci 58e41f4b71Sopenharmony_ci```ts 59e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 60e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 61e41f4b71Sopenharmony_ci 62e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 63e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 64e41f4b71Sopenharmony_cilet userId: number = 100; 65e41f4b71Sopenharmony_ci 66e41f4b71Sopenharmony_cibundle.getApplicationInfo(bundleName, bundleFlags, userId) 67e41f4b71Sopenharmony_ci .then((data) => { 68e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 69e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 70e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 71e41f4b71Sopenharmony_ci }) 72e41f4b71Sopenharmony_ci``` 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci## bundle.getApplicationInfo<sup>deprecated<sup> 75e41f4b71Sopenharmony_ci 76e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 77e41f4b71Sopenharmony_ci 78e41f4b71Sopenharmony_cigetApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ciObtains the application information of the specified user based on a given bundle name. This API uses an asynchronous callback to return the result. 81e41f4b71Sopenharmony_ci 82e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 83e41f4b71Sopenharmony_ci 84e41f4b71Sopenharmony_ci**Required permissions** 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 87e41f4b71Sopenharmony_ci 88e41f4b71Sopenharmony_ci**System capability** 89e41f4b71Sopenharmony_ci 90e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci**Parameters** 93e41f4b71Sopenharmony_ci 94e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 95e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 96e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 97e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 98e41f4b71Sopenharmony_ci| userId | number | Yes | User ID. The value must be greater than or equal to 0. | 99e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. | 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci**Example** 102e41f4b71Sopenharmony_ci 103e41f4b71Sopenharmony_ci```ts 104e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 105e41f4b71Sopenharmony_ci 106e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 107e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 108e41f4b71Sopenharmony_cilet userId: number = 100; 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_cibundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => { 111e41f4b71Sopenharmony_ci if (err) { 112e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 113e41f4b71Sopenharmony_ci return; 114e41f4b71Sopenharmony_ci } 115e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 116e41f4b71Sopenharmony_ci}) 117e41f4b71Sopenharmony_ci``` 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci## bundle.getApplicationInfo<sup>deprecated<sup> 120e41f4b71Sopenharmony_ci 121e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 122e41f4b71Sopenharmony_ci 123e41f4b71Sopenharmony_ci 124e41f4b71Sopenharmony_cigetApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>): void 125e41f4b71Sopenharmony_ci 126e41f4b71Sopenharmony_ciObtains the application information based on a given bundle name. This API uses an asynchronous callback to return the result. 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 129e41f4b71Sopenharmony_ci 130e41f4b71Sopenharmony_ci**Required permissions** 131e41f4b71Sopenharmony_ci 132e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci**System capability** 135e41f4b71Sopenharmony_ci 136e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 137e41f4b71Sopenharmony_ci 138e41f4b71Sopenharmony_ci**Parameters** 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 141e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 142e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 143e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 144e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. | 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_ci**Example** 147e41f4b71Sopenharmony_ci 148e41f4b71Sopenharmony_ci```ts 149e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 150e41f4b71Sopenharmony_ci 151e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 152e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 153e41f4b71Sopenharmony_ci 154e41f4b71Sopenharmony_cibundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { 155e41f4b71Sopenharmony_ci if (err) { 156e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 157e41f4b71Sopenharmony_ci return; 158e41f4b71Sopenharmony_ci } 159e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 160e41f4b71Sopenharmony_ci}) 161e41f4b71Sopenharmony_ci``` 162e41f4b71Sopenharmony_ci 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci## bundle.getAllBundleInfo<sup>deprecated<sup> 165e41f4b71Sopenharmony_ci 166e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 167e41f4b71Sopenharmony_ci 168e41f4b71Sopenharmony_cigetAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\<Array\<BundleInfo\>\> 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ciObtains the information of all bundles of the specified user. This API uses a promise to return the result. 171e41f4b71Sopenharmony_ci 172e41f4b71Sopenharmony_ci**Required permissions** 173e41f4b71Sopenharmony_ci 174e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 175e41f4b71Sopenharmony_ci 176e41f4b71Sopenharmony_ci**System capability** 177e41f4b71Sopenharmony_ci 178e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 179e41f4b71Sopenharmony_ci 180e41f4b71Sopenharmony_ci**Parameters** 181e41f4b71Sopenharmony_ci 182e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 183e41f4b71Sopenharmony_ci| ---------- | ---------- | ---- | ------------------------------------------------------------ | 184e41f4b71Sopenharmony_ci| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 185e41f4b71Sopenharmony_ci| 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. | 186e41f4b71Sopenharmony_ci 187e41f4b71Sopenharmony_ci**Return value** 188e41f4b71Sopenharmony_ci 189e41f4b71Sopenharmony_ci| Type | Description | 190e41f4b71Sopenharmony_ci| --------------------------- | -------------------------- | 191e41f4b71Sopenharmony_ci| Promise<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Promise used to return the information of all bundles.| 192e41f4b71Sopenharmony_ci 193e41f4b71Sopenharmony_ci**Example** 194e41f4b71Sopenharmony_ci 195e41f4b71Sopenharmony_ci```ts 196e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 197e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 198e41f4b71Sopenharmony_ci 199e41f4b71Sopenharmony_cilet bundleFlag: number = 0; 200e41f4b71Sopenharmony_cilet userId: number = 100; 201e41f4b71Sopenharmony_ci 202e41f4b71Sopenharmony_cibundle.getAllBundleInfo(bundleFlag, userId) 203e41f4b71Sopenharmony_ci .then((data) => { 204e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 205e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 206e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 207e41f4b71Sopenharmony_ci }) 208e41f4b71Sopenharmony_ci``` 209e41f4b71Sopenharmony_ci 210e41f4b71Sopenharmony_ci## bundle.getAllBundleInfo<sup>deprecated<sup> 211e41f4b71Sopenharmony_ci 212e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 213e41f4b71Sopenharmony_ci 214e41f4b71Sopenharmony_ci 215e41f4b71Sopenharmony_cigetAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo\>\>): void 216e41f4b71Sopenharmony_ci 217e41f4b71Sopenharmony_ciObtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result. 218e41f4b71Sopenharmony_ci 219e41f4b71Sopenharmony_ci**Required permissions** 220e41f4b71Sopenharmony_ci 221e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 222e41f4b71Sopenharmony_ci 223e41f4b71Sopenharmony_ci**System capability** 224e41f4b71Sopenharmony_ci 225e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 226e41f4b71Sopenharmony_ci 227e41f4b71Sopenharmony_ci**Parameters** 228e41f4b71Sopenharmony_ci 229e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 230e41f4b71Sopenharmony_ci| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 231e41f4b71Sopenharmony_ci| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 232e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all bundles. | 233e41f4b71Sopenharmony_ci 234e41f4b71Sopenharmony_ci**Example** 235e41f4b71Sopenharmony_ci 236e41f4b71Sopenharmony_ci```ts 237e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 238e41f4b71Sopenharmony_ci 239e41f4b71Sopenharmony_cilet bundleFlag: number = 0; 240e41f4b71Sopenharmony_ci 241e41f4b71Sopenharmony_cibundle.getAllBundleInfo(bundleFlag, (err, data) => { 242e41f4b71Sopenharmony_ci if (err) { 243e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 244e41f4b71Sopenharmony_ci return; 245e41f4b71Sopenharmony_ci } 246e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 247e41f4b71Sopenharmony_ci}) 248e41f4b71Sopenharmony_ci``` 249e41f4b71Sopenharmony_ci 250e41f4b71Sopenharmony_ci## bundle.getAllBundleInfo<sup>deprecated<sup> 251e41f4b71Sopenharmony_ci 252e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 253e41f4b71Sopenharmony_ci 254e41f4b71Sopenharmony_ci 255e41f4b71Sopenharmony_cigetAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo\>\>): void 256e41f4b71Sopenharmony_ci 257e41f4b71Sopenharmony_ciObtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result. 258e41f4b71Sopenharmony_ci 259e41f4b71Sopenharmony_ci**Required permissions** 260e41f4b71Sopenharmony_ci 261e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 262e41f4b71Sopenharmony_ci 263e41f4b71Sopenharmony_ci**System capability** 264e41f4b71Sopenharmony_ci 265e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 266e41f4b71Sopenharmony_ci 267e41f4b71Sopenharmony_ci**Parameters** 268e41f4b71Sopenharmony_ci 269e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 270e41f4b71Sopenharmony_ci|------------|-------------------------------------------------------------------|-----|---------------------------------------------------------------------| 271e41f4b71Sopenharmony_ci| bundleFlag | BundleFlag | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 272e41f4b71Sopenharmony_ci| 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. | 273e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[BundleInfo](js-apis-bundle-BundleInfo.md)>> | Yes | Callback used to return the information of all bundles. | 274e41f4b71Sopenharmony_ci| 275e41f4b71Sopenharmony_ci 276e41f4b71Sopenharmony_ci**Example** 277e41f4b71Sopenharmony_ci 278e41f4b71Sopenharmony_ci```ts 279e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 280e41f4b71Sopenharmony_ci 281e41f4b71Sopenharmony_cilet bundleFlag: number = 0; 282e41f4b71Sopenharmony_cilet userId: number = 100; 283e41f4b71Sopenharmony_ci 284e41f4b71Sopenharmony_cibundle.getAllBundleInfo(bundleFlag, userId, (err, data) => { 285e41f4b71Sopenharmony_ci if (err) { 286e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 287e41f4b71Sopenharmony_ci return; 288e41f4b71Sopenharmony_ci } 289e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 290e41f4b71Sopenharmony_ci}) 291e41f4b71Sopenharmony_ci``` 292e41f4b71Sopenharmony_ci 293e41f4b71Sopenharmony_ci## bundle.getBundleInfo<sup>deprecated<sup> 294e41f4b71Sopenharmony_ci 295e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 296e41f4b71Sopenharmony_ci 297e41f4b71Sopenharmony_ci 298e41f4b71Sopenharmony_cigetBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo> 299e41f4b71Sopenharmony_ci 300e41f4b71Sopenharmony_ciObtains the bundle information based on a given bundle name. This API uses a promise to return the result. 301e41f4b71Sopenharmony_ci 302e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 303e41f4b71Sopenharmony_ci 304e41f4b71Sopenharmony_ci**Required permissions** 305e41f4b71Sopenharmony_ci 306e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 307e41f4b71Sopenharmony_ci 308e41f4b71Sopenharmony_ci**System capability** 309e41f4b71Sopenharmony_ci 310e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 311e41f4b71Sopenharmony_ci 312e41f4b71Sopenharmony_ci**Parameters** 313e41f4b71Sopenharmony_ci 314e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 315e41f4b71Sopenharmony_ci| ----------- | ------------- | ---- |---------------------------------------------------------------------| 316e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 317e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 318e41f4b71Sopenharmony_ci| options | [BundleOptions](#bundleoptionsdeprecated) | No | Options that contain the user ID. | 319e41f4b71Sopenharmony_ci 320e41f4b71Sopenharmony_ci**Return value** 321e41f4b71Sopenharmony_ci 322e41f4b71Sopenharmony_ci| Type | Description | 323e41f4b71Sopenharmony_ci| -------------------- | ---------------------------- | 324e41f4b71Sopenharmony_ci| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the bundle information.| 325e41f4b71Sopenharmony_ci 326e41f4b71Sopenharmony_ci**Example** 327e41f4b71Sopenharmony_ci 328e41f4b71Sopenharmony_ci```ts 329e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 330e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 331e41f4b71Sopenharmony_ci 332e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 333e41f4b71Sopenharmony_cilet bundleFlags: number = 1; 334e41f4b71Sopenharmony_cilet options: bundle.BundleOptions = { 335e41f4b71Sopenharmony_ci "userId": 100 336e41f4b71Sopenharmony_ci}; 337e41f4b71Sopenharmony_ci 338e41f4b71Sopenharmony_cibundle.getBundleInfo(bundleName, bundleFlags, options) 339e41f4b71Sopenharmony_ci .then((data) => { 340e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 341e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 342e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 343e41f4b71Sopenharmony_ci }) 344e41f4b71Sopenharmony_ci``` 345e41f4b71Sopenharmony_ci 346e41f4b71Sopenharmony_ci## bundle.getBundleInfo<sup>deprecated<sup> 347e41f4b71Sopenharmony_ci 348e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 349e41f4b71Sopenharmony_ci 350e41f4b71Sopenharmony_cigetBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void 351e41f4b71Sopenharmony_ci 352e41f4b71Sopenharmony_ciObtains the bundle information based on a given bundle name. This API uses an asynchronous callback to return the result. 353e41f4b71Sopenharmony_ci 354e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 355e41f4b71Sopenharmony_ci 356e41f4b71Sopenharmony_ci**Required permissions** 357e41f4b71Sopenharmony_ci 358e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 359e41f4b71Sopenharmony_ci 360e41f4b71Sopenharmony_ci**System capability** 361e41f4b71Sopenharmony_ci 362e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 363e41f4b71Sopenharmony_ci 364e41f4b71Sopenharmony_ci**Parameters** 365e41f4b71Sopenharmony_ci 366e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 367e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ | 368e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 369e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 370e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. | 371e41f4b71Sopenharmony_ci 372e41f4b71Sopenharmony_ci**Example** 373e41f4b71Sopenharmony_ci 374e41f4b71Sopenharmony_ci```ts 375e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 376e41f4b71Sopenharmony_ci 377e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 378e41f4b71Sopenharmony_cilet bundleFlags: number = 1; 379e41f4b71Sopenharmony_ci 380e41f4b71Sopenharmony_cibundle.getBundleInfo(bundleName, bundleFlags, (err, data) => { 381e41f4b71Sopenharmony_ci if (err) { 382e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 383e41f4b71Sopenharmony_ci return; 384e41f4b71Sopenharmony_ci } 385e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 386e41f4b71Sopenharmony_ci}) 387e41f4b71Sopenharmony_ci``` 388e41f4b71Sopenharmony_ci 389e41f4b71Sopenharmony_ci## bundle.getBundleInfo<sup>deprecated<sup> 390e41f4b71Sopenharmony_ci 391e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 392e41f4b71Sopenharmony_ci 393e41f4b71Sopenharmony_cigetBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void 394e41f4b71Sopenharmony_ci 395e41f4b71Sopenharmony_ciObtains the bundle information based on a given bundle name and bundle options. This API uses an asynchronous callback to return the result. 396e41f4b71Sopenharmony_ci 397e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 398e41f4b71Sopenharmony_ci 399e41f4b71Sopenharmony_ci**Required permissions** 400e41f4b71Sopenharmony_ci 401e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 402e41f4b71Sopenharmony_ci 403e41f4b71Sopenharmony_ci**System capability** 404e41f4b71Sopenharmony_ci 405e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 406e41f4b71Sopenharmony_ci 407e41f4b71Sopenharmony_ci**Parameters** 408e41f4b71Sopenharmony_ci 409e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 410e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------------------------- | ---- | ------------------------------------------------------------ | 411e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 412e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 413e41f4b71Sopenharmony_ci| options | [BundleOptions](#bundleoptionsdeprecated) | Yes | Includes **userId**. | 414e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. | 415e41f4b71Sopenharmony_ci 416e41f4b71Sopenharmony_ci**Example** 417e41f4b71Sopenharmony_ci 418e41f4b71Sopenharmony_ci```ts 419e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 420e41f4b71Sopenharmony_ci 421e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 422e41f4b71Sopenharmony_cilet bundleFlags: number = 1; 423e41f4b71Sopenharmony_cilet options: bundle.BundleOptions = { 424e41f4b71Sopenharmony_ci "userId": 100 425e41f4b71Sopenharmony_ci}; 426e41f4b71Sopenharmony_ci 427e41f4b71Sopenharmony_cibundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => { 428e41f4b71Sopenharmony_ci if (err) { 429e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 430e41f4b71Sopenharmony_ci return; 431e41f4b71Sopenharmony_ci } 432e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 433e41f4b71Sopenharmony_ci}) 434e41f4b71Sopenharmony_ci``` 435e41f4b71Sopenharmony_ci 436e41f4b71Sopenharmony_ci## bundle.getAllApplicationInfo<sup>deprecated<sup> 437e41f4b71Sopenharmony_ci 438e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 439e41f4b71Sopenharmony_ci 440e41f4b71Sopenharmony_cigetAllApplicationInfo(bundleFlags: number, userId?: number): Promise\<Array\<ApplicationInfo\>\> 441e41f4b71Sopenharmony_ci 442e41f4b71Sopenharmony_ciObtains the information about all applications of the specified user. This API uses a promise to return the result. 443e41f4b71Sopenharmony_ci 444e41f4b71Sopenharmony_ci**Required permissions** 445e41f4b71Sopenharmony_ci 446e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 447e41f4b71Sopenharmony_ci 448e41f4b71Sopenharmony_ci**System capability** 449e41f4b71Sopenharmony_ci 450e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 451e41f4b71Sopenharmony_ci 452e41f4b71Sopenharmony_ci**Parameters** 453e41f4b71Sopenharmony_ci 454e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 455e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ------------------------------------------------------------ | 456e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 457e41f4b71Sopenharmony_ci| 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. | 458e41f4b71Sopenharmony_ci 459e41f4b71Sopenharmony_ci**Return value** 460e41f4b71Sopenharmony_ci 461e41f4b71Sopenharmony_ci| Type | Description | 462e41f4b71Sopenharmony_ci| -------------------------------- | ------------------------------- | 463e41f4b71Sopenharmony_ci| Promise<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Promise used to return the application information.| 464e41f4b71Sopenharmony_ci 465e41f4b71Sopenharmony_ci**Example** 466e41f4b71Sopenharmony_ci 467e41f4b71Sopenharmony_ci```ts 468e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 469e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 470e41f4b71Sopenharmony_ci 471e41f4b71Sopenharmony_cilet bundleFlags: number = 8; 472e41f4b71Sopenharmony_cilet userId: number = 100; 473e41f4b71Sopenharmony_ci 474e41f4b71Sopenharmony_cibundle.getAllApplicationInfo(bundleFlags, userId) 475e41f4b71Sopenharmony_ci .then((data) => { 476e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 477e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 478e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 479e41f4b71Sopenharmony_ci }) 480e41f4b71Sopenharmony_ci``` 481e41f4b71Sopenharmony_ci 482e41f4b71Sopenharmony_ci## bundle.getAllApplicationInfo<sup>deprecated<sup> 483e41f4b71Sopenharmony_ci 484e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 485e41f4b71Sopenharmony_ci 486e41f4b71Sopenharmony_cigetAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo\>\>): void 487e41f4b71Sopenharmony_ci 488e41f4b71Sopenharmony_ciObtains the information about all applications. This API uses an asynchronous callback to return the result. 489e41f4b71Sopenharmony_ci 490e41f4b71Sopenharmony_ci**Required permissions** 491e41f4b71Sopenharmony_ci 492e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 493e41f4b71Sopenharmony_ci 494e41f4b71Sopenharmony_ci**System capability** 495e41f4b71Sopenharmony_ci 496e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 497e41f4b71Sopenharmony_ci 498e41f4b71Sopenharmony_ci**Parameters** 499e41f4b71Sopenharmony_ci 500e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 501e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 502e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 503e41f4b71Sopenharmony_ci| 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. | 504e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. | 505e41f4b71Sopenharmony_ci 506e41f4b71Sopenharmony_ci**Example** 507e41f4b71Sopenharmony_ci 508e41f4b71Sopenharmony_ci```ts 509e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 510e41f4b71Sopenharmony_ci 511e41f4b71Sopenharmony_cilet bundleFlags: number = bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION; 512e41f4b71Sopenharmony_cilet userId: number = 100; 513e41f4b71Sopenharmony_ci 514e41f4b71Sopenharmony_cibundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => { 515e41f4b71Sopenharmony_ci if (err) { 516e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 517e41f4b71Sopenharmony_ci return; 518e41f4b71Sopenharmony_ci } 519e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 520e41f4b71Sopenharmony_ci}) 521e41f4b71Sopenharmony_ci``` 522e41f4b71Sopenharmony_ci 523e41f4b71Sopenharmony_ci 524e41f4b71Sopenharmony_ci## bundle.getAllApplicationInfo<sup>deprecated<sup> 525e41f4b71Sopenharmony_ci 526e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 527e41f4b71Sopenharmony_ci 528e41f4b71Sopenharmony_cigetAllApplicationInfo(bundleFlags: number, callback: AsyncCallback\<Array\<ApplicationInfo\>\>): void 529e41f4b71Sopenharmony_ci 530e41f4b71Sopenharmony_ciObtains the information about all applications of the current user. This API uses an asynchronous callback to return the result. 531e41f4b71Sopenharmony_ci 532e41f4b71Sopenharmony_ci**Required permissions** 533e41f4b71Sopenharmony_ci 534e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 535e41f4b71Sopenharmony_ci 536e41f4b71Sopenharmony_ci**System capability** 537e41f4b71Sopenharmony_ci 538e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 539e41f4b71Sopenharmony_ci 540e41f4b71Sopenharmony_ci**Parameters** 541e41f4b71Sopenharmony_ci 542e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 543e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 544e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Type of information that will be returned. For details about the available enumerated values, see the application information flags in [BundleFlag](#bundleflagdeprecated).| 545e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)>> | Yes | Callback used to return the application information. | 546e41f4b71Sopenharmony_ci 547e41f4b71Sopenharmony_ci**Example** 548e41f4b71Sopenharmony_ci 549e41f4b71Sopenharmony_ci```ts 550e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 551e41f4b71Sopenharmony_ci 552e41f4b71Sopenharmony_cilet bundleFlags: number = bundle.BundleFlag.GET_APPLICATION_INFO_WITH_PERMISSION; 553e41f4b71Sopenharmony_ci 554e41f4b71Sopenharmony_cibundle.getAllApplicationInfo(bundleFlags, (err, data) => { 555e41f4b71Sopenharmony_ci if (err) { 556e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 557e41f4b71Sopenharmony_ci return; 558e41f4b71Sopenharmony_ci } 559e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 560e41f4b71Sopenharmony_ci}) 561e41f4b71Sopenharmony_ci``` 562e41f4b71Sopenharmony_ci 563e41f4b71Sopenharmony_ci## bundle.getBundleArchiveInfo<sup>deprecated<sup> 564e41f4b71Sopenharmony_ci 565e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 566e41f4b71Sopenharmony_ci 567e41f4b71Sopenharmony_cigetBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo> 568e41f4b71Sopenharmony_ci 569e41f4b71Sopenharmony_ciObtains information about the bundles contained in a HAP file. This API uses a promise to return the result. 570e41f4b71Sopenharmony_ci 571e41f4b71Sopenharmony_ci**System capability** 572e41f4b71Sopenharmony_ci 573e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 574e41f4b71Sopenharmony_ci 575e41f4b71Sopenharmony_ci**Parameters** 576e41f4b71Sopenharmony_ci 577e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 578e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ------------ | 579e41f4b71Sopenharmony_ci| hapFilePath | string | Yes | Path where the HAP file is stored. The absolute path of the application and the data directory sandbox path are supported.| 580e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 581e41f4b71Sopenharmony_ci 582e41f4b71Sopenharmony_ci**Return value** 583e41f4b71Sopenharmony_ci| Type | Description | 584e41f4b71Sopenharmony_ci| ---------------------------------------------------- | ------------------------------------------------------------ | 585e41f4b71Sopenharmony_ci| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the information about the bundles.| 586e41f4b71Sopenharmony_ci 587e41f4b71Sopenharmony_ci**Example** 588e41f4b71Sopenharmony_ci 589e41f4b71Sopenharmony_ci```ts 590e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 591e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 592e41f4b71Sopenharmony_ci 593e41f4b71Sopenharmony_cilet hapFilePath: string = "/data/storage/el2/base/test.hap"; 594e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 595e41f4b71Sopenharmony_ci 596e41f4b71Sopenharmony_cibundle.getBundleArchiveInfo(hapFilePath, bundleFlags) 597e41f4b71Sopenharmony_ci .then((data) => { 598e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 599e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 600e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 601e41f4b71Sopenharmony_ci }) 602e41f4b71Sopenharmony_ci``` 603e41f4b71Sopenharmony_ci 604e41f4b71Sopenharmony_ci## bundle.getBundleArchiveInfo<sup>deprecated<sup> 605e41f4b71Sopenharmony_ci 606e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 607e41f4b71Sopenharmony_ci 608e41f4b71Sopenharmony_cigetBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void 609e41f4b71Sopenharmony_ci 610e41f4b71Sopenharmony_ciObtains information about the bundles contained in a HAP file. This API uses an asynchronous callback to return the result. 611e41f4b71Sopenharmony_ci 612e41f4b71Sopenharmony_ci**System capability** 613e41f4b71Sopenharmony_ci 614e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 615e41f4b71Sopenharmony_ci 616e41f4b71Sopenharmony_ci**Parameters** 617e41f4b71Sopenharmony_ci 618e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 619e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ------------ | 620e41f4b71Sopenharmony_ci| hapFilePath | string | Yes | Path where the HAP file is stored. The absolute path of the application and the data directory sandbox path are supported.| 621e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Flags used to specify information contained in the **BundleInfo** object that will be returned. For details about the available enumerated values, see the bundle information flags in [BundleFlag](#bundleflagdeprecated).| 622e41f4b71Sopenharmony_ci| callback| AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the information about the bundles.| 623e41f4b71Sopenharmony_ci 624e41f4b71Sopenharmony_ci**Example** 625e41f4b71Sopenharmony_ci 626e41f4b71Sopenharmony_ci```ts 627e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 628e41f4b71Sopenharmony_ci 629e41f4b71Sopenharmony_cilet hapFilePath: string = "/data/storage/el2/base/test.hap"; 630e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 631e41f4b71Sopenharmony_ci 632e41f4b71Sopenharmony_cibundle.getBundleArchiveInfo(hapFilePath, bundleFlags, (err, data) => { 633e41f4b71Sopenharmony_ci if (err) { 634e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 635e41f4b71Sopenharmony_ci return; 636e41f4b71Sopenharmony_ci } 637e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 638e41f4b71Sopenharmony_ci}) 639e41f4b71Sopenharmony_ci``` 640e41f4b71Sopenharmony_ci 641e41f4b71Sopenharmony_ci## bundle.getAbilityInfo<sup>deprecated<sup> 642e41f4b71Sopenharmony_ci 643e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 644e41f4b71Sopenharmony_ci 645e41f4b71Sopenharmony_cigetAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo> 646e41f4b71Sopenharmony_ci 647e41f4b71Sopenharmony_ciObtains the ability information based on a given bundle name and ability name. This API uses a promise to return the result. 648e41f4b71Sopenharmony_ci 649e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 650e41f4b71Sopenharmony_ci 651e41f4b71Sopenharmony_ci**Required permissions** 652e41f4b71Sopenharmony_ci 653e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 654e41f4b71Sopenharmony_ci 655e41f4b71Sopenharmony_ci**System capability** 656e41f4b71Sopenharmony_ci 657e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 658e41f4b71Sopenharmony_ci 659e41f4b71Sopenharmony_ci**Parameters** 660e41f4b71Sopenharmony_ci 661e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 662e41f4b71Sopenharmony_ci| ----------- | ------ | ---- |------------| 663e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 664e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name.| 665e41f4b71Sopenharmony_ci 666e41f4b71Sopenharmony_ci**Return value** 667e41f4b71Sopenharmony_ci 668e41f4b71Sopenharmony_ci| Type | Description | 669e41f4b71Sopenharmony_ci| --------------------- | --------------------- | 670e41f4b71Sopenharmony_ci| Promise\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Promise used to return the ability information.| 671e41f4b71Sopenharmony_ci 672e41f4b71Sopenharmony_ci**Example** 673e41f4b71Sopenharmony_ci 674e41f4b71Sopenharmony_ci```ts 675e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 676e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 677e41f4b71Sopenharmony_ci 678e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 679e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 680e41f4b71Sopenharmony_ci 681e41f4b71Sopenharmony_cibundle.getAbilityInfo(bundleName, abilityName) 682e41f4b71Sopenharmony_ci .then((data) => { 683e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 684e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 685e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 686e41f4b71Sopenharmony_ci }) 687e41f4b71Sopenharmony_ci``` 688e41f4b71Sopenharmony_ci 689e41f4b71Sopenharmony_ci## bundle.getAbilityInfo<sup>deprecated<sup> 690e41f4b71Sopenharmony_ci 691e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 692e41f4b71Sopenharmony_ci 693e41f4b71Sopenharmony_cigetAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void 694e41f4b71Sopenharmony_ci 695e41f4b71Sopenharmony_ciObtains the ability information based on a given bundle name and ability name. This API uses an asynchronous callback to return the result. 696e41f4b71Sopenharmony_ci 697e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 698e41f4b71Sopenharmony_ci 699e41f4b71Sopenharmony_ci**Required permissions** 700e41f4b71Sopenharmony_ci 701e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 702e41f4b71Sopenharmony_ci 703e41f4b71Sopenharmony_ci**System capability** 704e41f4b71Sopenharmony_ci 705e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 706e41f4b71Sopenharmony_ci 707e41f4b71Sopenharmony_ci**Parameters** 708e41f4b71Sopenharmony_ci 709e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 710e41f4b71Sopenharmony_ci| ----------- | ------------ | ---- |----------------------------| 711e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 712e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name. | 713e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.| 714e41f4b71Sopenharmony_ci 715e41f4b71Sopenharmony_ci**Example** 716e41f4b71Sopenharmony_ci 717e41f4b71Sopenharmony_ci```ts 718e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 719e41f4b71Sopenharmony_ci 720e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 721e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 722e41f4b71Sopenharmony_ci 723e41f4b71Sopenharmony_cibundle.getAbilityInfo(bundleName, abilityName, (err, data) => { 724e41f4b71Sopenharmony_ci if (err) { 725e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 726e41f4b71Sopenharmony_ci return; 727e41f4b71Sopenharmony_ci } 728e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 729e41f4b71Sopenharmony_ci}) 730e41f4b71Sopenharmony_ci``` 731e41f4b71Sopenharmony_ci 732e41f4b71Sopenharmony_ci## bundle.getAbilityLabel<sup>8+</sup> <sup>deprecated<sup> 733e41f4b71Sopenharmony_ci 734e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 735e41f4b71Sopenharmony_ci 736e41f4b71Sopenharmony_cigetAbilityLabel(bundleName: string, abilityName: string): Promise\<string> 737e41f4b71Sopenharmony_ci 738e41f4b71Sopenharmony_ciObtains the application name based on a given bundle name and ability name. This API uses a promise to return the result. 739e41f4b71Sopenharmony_ci 740e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 741e41f4b71Sopenharmony_ci 742e41f4b71Sopenharmony_ci**Required permissions** 743e41f4b71Sopenharmony_ci 744e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 745e41f4b71Sopenharmony_ci 746e41f4b71Sopenharmony_ci**System capability** 747e41f4b71Sopenharmony_ci 748e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 749e41f4b71Sopenharmony_ci 750e41f4b71Sopenharmony_ci**Parameters** 751e41f4b71Sopenharmony_ci 752e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 753e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ---------------- | 754e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 755e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name. | 756e41f4b71Sopenharmony_ci 757e41f4b71Sopenharmony_ci**Return value** 758e41f4b71Sopenharmony_ci 759e41f4b71Sopenharmony_ci| Type | Description | 760e41f4b71Sopenharmony_ci| ---------------- | ------------------ | 761e41f4b71Sopenharmony_ci| Promise\<string> | Promise used to return the application name.| 762e41f4b71Sopenharmony_ci 763e41f4b71Sopenharmony_ci**Example** 764e41f4b71Sopenharmony_ci 765e41f4b71Sopenharmony_ci```ts 766e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 767e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 768e41f4b71Sopenharmony_ci 769e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 770e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 771e41f4b71Sopenharmony_ci 772e41f4b71Sopenharmony_cibundle.getAbilityLabel(bundleName, abilityName) 773e41f4b71Sopenharmony_ci .then((data) => { 774e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 775e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 776e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 777e41f4b71Sopenharmony_ci }) 778e41f4b71Sopenharmony_ci``` 779e41f4b71Sopenharmony_ci 780e41f4b71Sopenharmony_ci## bundle.getAbilityLabel<sup>8+</sup> <sup>deprecated<sup> 781e41f4b71Sopenharmony_ci 782e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 783e41f4b71Sopenharmony_ci 784e41f4b71Sopenharmony_cigetAbilityLabel(bundleName: string, abilityName: string, callback : AsyncCallback\<string>): void 785e41f4b71Sopenharmony_ci 786e41f4b71Sopenharmony_ciObtains the application name based on a given bundle name and ability name. This API uses an asynchronous callback to return the result. 787e41f4b71Sopenharmony_ci 788e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 789e41f4b71Sopenharmony_ci 790e41f4b71Sopenharmony_ci**Required permissions** 791e41f4b71Sopenharmony_ci 792e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 793e41f4b71Sopenharmony_ci 794e41f4b71Sopenharmony_ci**System capability** 795e41f4b71Sopenharmony_ci 796e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 797e41f4b71Sopenharmony_ci 798e41f4b71Sopenharmony_ci**Parameters** 799e41f4b71Sopenharmony_ci 800e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 801e41f4b71Sopenharmony_ci| ----------- | ---------------------- | ---- | ---------------------------------------------- | 802e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 803e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name. | 804e41f4b71Sopenharmony_ci| callback | AsyncCallback\<string> | Yes | Callback used to return the application name.| 805e41f4b71Sopenharmony_ci 806e41f4b71Sopenharmony_ci**Example** 807e41f4b71Sopenharmony_ci 808e41f4b71Sopenharmony_ci```ts 809e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 810e41f4b71Sopenharmony_ci 811e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 812e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 813e41f4b71Sopenharmony_ci 814e41f4b71Sopenharmony_cibundle.getAbilityLabel(bundleName, abilityName, (err, data) => { 815e41f4b71Sopenharmony_ci if (err) { 816e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 817e41f4b71Sopenharmony_ci return; 818e41f4b71Sopenharmony_ci } 819e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 820e41f4b71Sopenharmony_ci}) 821e41f4b71Sopenharmony_ci``` 822e41f4b71Sopenharmony_ci 823e41f4b71Sopenharmony_ci## bundle.isAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 824e41f4b71Sopenharmony_ci 825e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 826e41f4b71Sopenharmony_ci 827e41f4b71Sopenharmony_ciisAbilityEnabled(info: AbilityInfo): Promise\<boolean> 828e41f4b71Sopenharmony_ci 829e41f4b71Sopenharmony_ciChecks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses a promise to return the result. 830e41f4b71Sopenharmony_ci 831e41f4b71Sopenharmony_ci**System capability** 832e41f4b71Sopenharmony_ci 833e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 834e41f4b71Sopenharmony_ci 835e41f4b71Sopenharmony_ci**Parameters** 836e41f4b71Sopenharmony_ci 837e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 838e41f4b71Sopenharmony_ci| ------ | -------------------------------------------- | ---- | ----------------- | 839e41f4b71Sopenharmony_ci| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information.| 840e41f4b71Sopenharmony_ci 841e41f4b71Sopenharmony_ci**Return value** 842e41f4b71Sopenharmony_ci 843e41f4b71Sopenharmony_ci| Type | Description | 844e41f4b71Sopenharmony_ci| ----------------- | ------------------------- | 845e41f4b71Sopenharmony_ci| Promise\<boolean> | Promise used to return the result. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| 846e41f4b71Sopenharmony_ci 847e41f4b71Sopenharmony_ci**Example** 848e41f4b71Sopenharmony_ci 849e41f4b71Sopenharmony_ci```ts 850e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 851e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 852e41f4b71Sopenharmony_ci 853e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 854e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 855e41f4b71Sopenharmony_ci 856e41f4b71Sopenharmony_cibundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo) => { 857e41f4b71Sopenharmony_ci bundle.isAbilityEnabled(abilityInfo).then((data) => { 858e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 859e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 860e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 861e41f4b71Sopenharmony_ci }) 862e41f4b71Sopenharmony_ci}) 863e41f4b71Sopenharmony_ci``` 864e41f4b71Sopenharmony_ci 865e41f4b71Sopenharmony_ci## bundle.isAbilityEnabled<sup>8+</sup> <sup>deprecated<sup> 866e41f4b71Sopenharmony_ci 867e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 868e41f4b71Sopenharmony_ci 869e41f4b71Sopenharmony_ciisAbilityEnabled(info : AbilityInfo, callback : AsyncCallback\<boolean>): void 870e41f4b71Sopenharmony_ci 871e41f4b71Sopenharmony_ciChecks whether the ability that matches a given **AbilityInfo** object is enabled. This API uses an asynchronous callback to return the result. 872e41f4b71Sopenharmony_ci 873e41f4b71Sopenharmony_ci**System capability** 874e41f4b71Sopenharmony_ci 875e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 876e41f4b71Sopenharmony_ci 877e41f4b71Sopenharmony_ci**Parameters** 878e41f4b71Sopenharmony_ci 879e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 880e41f4b71Sopenharmony_ci| -------- | -------------------------------------------- | ---- | ----------------------- | 881e41f4b71Sopenharmony_ci| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. | 882e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.| 883e41f4b71Sopenharmony_ci 884e41f4b71Sopenharmony_ci**Example** 885e41f4b71Sopenharmony_ci 886e41f4b71Sopenharmony_ci```ts 887e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 888e41f4b71Sopenharmony_ci 889e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 890e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 891e41f4b71Sopenharmony_ci 892e41f4b71Sopenharmony_cibundle.getAbilityInfo(bundleName, abilityName).then((abilityInfo) => { 893e41f4b71Sopenharmony_ci bundle.isAbilityEnabled(abilityInfo, (err, data) => { 894e41f4b71Sopenharmony_ci if (err) { 895e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 896e41f4b71Sopenharmony_ci return; 897e41f4b71Sopenharmony_ci } 898e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 899e41f4b71Sopenharmony_ci }) 900e41f4b71Sopenharmony_ci}) 901e41f4b71Sopenharmony_ci``` 902e41f4b71Sopenharmony_ci 903e41f4b71Sopenharmony_ci## bundle.isApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 904e41f4b71Sopenharmony_ci 905e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 906e41f4b71Sopenharmony_ci 907e41f4b71Sopenharmony_ciisApplicationEnabled(bundleName: string): Promise\<boolean> 908e41f4b71Sopenharmony_ci 909e41f4b71Sopenharmony_ciChecks whether an application is enabled based on a given bundle name. This API uses a promise to return the result. 910e41f4b71Sopenharmony_ci 911e41f4b71Sopenharmony_ci**System capability** 912e41f4b71Sopenharmony_ci 913e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 914e41f4b71Sopenharmony_ci 915e41f4b71Sopenharmony_ci**Parameters** 916e41f4b71Sopenharmony_ci 917e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 918e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ------------------------ | 919e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 920e41f4b71Sopenharmony_ci 921e41f4b71Sopenharmony_ci**Return value** 922e41f4b71Sopenharmony_ci 923e41f4b71Sopenharmony_ci| Type | Description | 924e41f4b71Sopenharmony_ci| ----------------- | ------------------------- | 925e41f4b71Sopenharmony_ci| Promise\<boolean> | Promise used to return the result. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| 926e41f4b71Sopenharmony_ci 927e41f4b71Sopenharmony_ci**Example** 928e41f4b71Sopenharmony_ci 929e41f4b71Sopenharmony_ci```ts 930e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 931e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 932e41f4b71Sopenharmony_ci 933e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 934e41f4b71Sopenharmony_ci 935e41f4b71Sopenharmony_cibundle.isApplicationEnabled(bundleName) 936e41f4b71Sopenharmony_ci .then((data) => { 937e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 938e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 939e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 940e41f4b71Sopenharmony_ci }) 941e41f4b71Sopenharmony_ci``` 942e41f4b71Sopenharmony_ci 943e41f4b71Sopenharmony_ci## bundle.isApplicationEnabled<sup>8+</sup> <sup>deprecated<sup> 944e41f4b71Sopenharmony_ci 945e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 946e41f4b71Sopenharmony_ci 947e41f4b71Sopenharmony_ciisApplicationEnabled(bundleName: string, callback : AsyncCallback\<boolean>): void 948e41f4b71Sopenharmony_ci 949e41f4b71Sopenharmony_ciChecks whether an application is enabled based on a given bundle name. This API uses an asynchronous callback to return the result. 950e41f4b71Sopenharmony_ci 951e41f4b71Sopenharmony_ci**System capability** 952e41f4b71Sopenharmony_ci 953e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 954e41f4b71Sopenharmony_ci 955e41f4b71Sopenharmony_ci**Parameters** 956e41f4b71Sopenharmony_ci 957e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 958e41f4b71Sopenharmony_ci| ---------- | ----------------------- | ---- | ------------------------ | 959e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 960e41f4b71Sopenharmony_ci| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. If the application is enabled, **true** will be returned; otherwise, **false** will be returned.| 961e41f4b71Sopenharmony_ci 962e41f4b71Sopenharmony_ci**Example** 963e41f4b71Sopenharmony_ci 964e41f4b71Sopenharmony_ci```ts 965e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 966e41f4b71Sopenharmony_ci 967e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 968e41f4b71Sopenharmony_ci 969e41f4b71Sopenharmony_cibundle.isApplicationEnabled(bundleName, (err, data) => { 970e41f4b71Sopenharmony_ci if (err) { 971e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 972e41f4b71Sopenharmony_ci return; 973e41f4b71Sopenharmony_ci } 974e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 975e41f4b71Sopenharmony_ci}) 976e41f4b71Sopenharmony_ci``` 977e41f4b71Sopenharmony_ci 978e41f4b71Sopenharmony_ci## bundle.queryAbilityByWant<sup>deprecated<sup> 979e41f4b71Sopenharmony_ci 980e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 981e41f4b71Sopenharmony_ci 982e41f4b71Sopenharmony_ciqueryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\<Array\<AbilityInfo\>\> 983e41f4b71Sopenharmony_ci 984e41f4b71Sopenharmony_ciObtains the ability information based on given Want. This API uses a promise to return the result. 985e41f4b71Sopenharmony_ci 986e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 987e41f4b71Sopenharmony_ci 988e41f4b71Sopenharmony_ci**Required permissions** 989e41f4b71Sopenharmony_ci 990e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 991e41f4b71Sopenharmony_ci 992e41f4b71Sopenharmony_ci**System capability** 993e41f4b71Sopenharmony_ci 994e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 995e41f4b71Sopenharmony_ci 996e41f4b71Sopenharmony_ci**Parameters** 997e41f4b71Sopenharmony_ci 998e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 999e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ------------------------------------- | 1000e41f4b71Sopenharmony_ci| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name. | 1001e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1002e41f4b71Sopenharmony_ci| 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. | 1003e41f4b71Sopenharmony_ci 1004e41f4b71Sopenharmony_ci**Return value** 1005e41f4b71Sopenharmony_ci 1006e41f4b71Sopenharmony_ci| Type | Description | 1007e41f4b71Sopenharmony_ci| ---------------------------- | --------------------- | 1008e41f4b71Sopenharmony_ci| Promise<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Promise used to return the ability information.| 1009e41f4b71Sopenharmony_ci 1010e41f4b71Sopenharmony_ci**Example** 1011e41f4b71Sopenharmony_ci 1012e41f4b71Sopenharmony_ci```ts 1013e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1014e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 1015e41f4b71Sopenharmony_ciimport Want from '@ohos.app.ability.Want'; 1016e41f4b71Sopenharmony_ci 1017e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 1018e41f4b71Sopenharmony_cilet userId: number = 100; 1019e41f4b71Sopenharmony_cilet want: Want = { 1020e41f4b71Sopenharmony_ci bundleName: "com.example.myapplication", 1021e41f4b71Sopenharmony_ci abilityName: "EntryAbility" 1022e41f4b71Sopenharmony_ci}; 1023e41f4b71Sopenharmony_ci 1024e41f4b71Sopenharmony_cibundle.queryAbilityByWant(want, bundleFlags, userId) 1025e41f4b71Sopenharmony_ci .then((data) => { 1026e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 1027e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 1028e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1029e41f4b71Sopenharmony_ci }) 1030e41f4b71Sopenharmony_ci``` 1031e41f4b71Sopenharmony_ci 1032e41f4b71Sopenharmony_ci 1033e41f4b71Sopenharmony_ci 1034e41f4b71Sopenharmony_ci## bundle.queryAbilityByWant<sup>deprecated<sup> 1035e41f4b71Sopenharmony_ci 1036e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1037e41f4b71Sopenharmony_ci 1038e41f4b71Sopenharmony_ciqueryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void 1039e41f4b71Sopenharmony_ci 1040e41f4b71Sopenharmony_ciObtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result. 1041e41f4b71Sopenharmony_ci 1042e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 1043e41f4b71Sopenharmony_ci 1044e41f4b71Sopenharmony_ci**Required permissions** 1045e41f4b71Sopenharmony_ci 1046e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1047e41f4b71Sopenharmony_ci 1048e41f4b71Sopenharmony_ci**System capability** 1049e41f4b71Sopenharmony_ci 1050e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1051e41f4b71Sopenharmony_ci 1052e41f4b71Sopenharmony_ci**Parameters** 1053e41f4b71Sopenharmony_ci 1054e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1055e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1056e41f4b71Sopenharmony_ci| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name. | 1057e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1058e41f4b71Sopenharmony_ci| userId | number | Yes | User ID. The value must be greater than or equal to 0. | 1059e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. | 1060e41f4b71Sopenharmony_ci 1061e41f4b71Sopenharmony_ci**Example** 1062e41f4b71Sopenharmony_ci 1063e41f4b71Sopenharmony_ci```ts 1064e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1065e41f4b71Sopenharmony_ciimport Want from '@ohos.app.ability.Want'; 1066e41f4b71Sopenharmony_ci 1067e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 1068e41f4b71Sopenharmony_cilet userId: number = 100; 1069e41f4b71Sopenharmony_cilet want: Want = { 1070e41f4b71Sopenharmony_ci bundleName: "com.example.myapplication", 1071e41f4b71Sopenharmony_ci abilityName: "EntryAbility" 1072e41f4b71Sopenharmony_ci}; 1073e41f4b71Sopenharmony_ci 1074e41f4b71Sopenharmony_cibundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { 1075e41f4b71Sopenharmony_ci if (err) { 1076e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1077e41f4b71Sopenharmony_ci return; 1078e41f4b71Sopenharmony_ci } 1079e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 1080e41f4b71Sopenharmony_ci}) 1081e41f4b71Sopenharmony_ci``` 1082e41f4b71Sopenharmony_ci 1083e41f4b71Sopenharmony_ci## bundle.queryAbilityByWant<sup>deprecated<sup> 1084e41f4b71Sopenharmony_ci 1085e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1086e41f4b71Sopenharmony_ci 1087e41f4b71Sopenharmony_ciqueryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo\>\>): void 1088e41f4b71Sopenharmony_ci 1089e41f4b71Sopenharmony_ciObtains the ability information based on given Want. This API uses an asynchronous callback to return the result. 1090e41f4b71Sopenharmony_ci 1091e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 1092e41f4b71Sopenharmony_ci 1093e41f4b71Sopenharmony_ci**Required permissions** 1094e41f4b71Sopenharmony_ci 1095e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1096e41f4b71Sopenharmony_ci 1097e41f4b71Sopenharmony_ci**System capability** 1098e41f4b71Sopenharmony_ci 1099e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1100e41f4b71Sopenharmony_ci 1101e41f4b71Sopenharmony_ci**Parameters** 1102e41f4b71Sopenharmony_ci 1103e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1104e41f4b71Sopenharmony_ci| ----------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | 1105e41f4b71Sopenharmony_ci| want | [Want](js-apis-application-want.md) | Yes | Want containing the bundle name. | 1106e41f4b71Sopenharmony_ci| bundleFlags | number | Yes | Ability information to be returned. For details about the available enumerated values, see the ability information flags in [BundleFlag](#bundleflagdeprecated).| 1107e41f4b71Sopenharmony_ci| callback | AsyncCallback<Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)>> | Yes | Callback used to return the ability information. | 1108e41f4b71Sopenharmony_ci 1109e41f4b71Sopenharmony_ci**Example** 1110e41f4b71Sopenharmony_ci 1111e41f4b71Sopenharmony_ci```ts 1112e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1113e41f4b71Sopenharmony_ciimport Want from '@ohos.app.ability.Want'; 1114e41f4b71Sopenharmony_ci 1115e41f4b71Sopenharmony_cilet bundleFlags: number = 0; 1116e41f4b71Sopenharmony_cilet want: Want = { 1117e41f4b71Sopenharmony_ci bundleName: "com.example.myapplication", 1118e41f4b71Sopenharmony_ci abilityName: "EntryAbility" 1119e41f4b71Sopenharmony_ci}; 1120e41f4b71Sopenharmony_ci 1121e41f4b71Sopenharmony_cibundle.queryAbilityByWant(want, bundleFlags, (err, data) => { 1122e41f4b71Sopenharmony_ci if (err) { 1123e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1124e41f4b71Sopenharmony_ci return; 1125e41f4b71Sopenharmony_ci } 1126e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 1127e41f4b71Sopenharmony_ci}) 1128e41f4b71Sopenharmony_ci``` 1129e41f4b71Sopenharmony_ci 1130e41f4b71Sopenharmony_ci 1131e41f4b71Sopenharmony_ci 1132e41f4b71Sopenharmony_ci## bundle.getLaunchWantForBundle<sup>deprecated<sup> 1133e41f4b71Sopenharmony_ci 1134e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1135e41f4b71Sopenharmony_ci 1136e41f4b71Sopenharmony_cigetLaunchWantForBundle(bundleName: string): Promise\<Want> 1137e41f4b71Sopenharmony_ci 1138e41f4b71Sopenharmony_ciObtains the **Want** object that launches the specified application. This API uses a promise to return the result. 1139e41f4b71Sopenharmony_ci 1140e41f4b71Sopenharmony_ci**Required permissions** 1141e41f4b71Sopenharmony_ci 1142e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1143e41f4b71Sopenharmony_ci 1144e41f4b71Sopenharmony_ci**System capability** 1145e41f4b71Sopenharmony_ci 1146e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1147e41f4b71Sopenharmony_ci 1148e41f4b71Sopenharmony_ci**Parameters** 1149e41f4b71Sopenharmony_ci 1150e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1151e41f4b71Sopenharmony_ci| ---------- | ------ | ---- | ------------------------ | 1152e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 1153e41f4b71Sopenharmony_ci 1154e41f4b71Sopenharmony_ci**Return value** 1155e41f4b71Sopenharmony_ci| Type | Description | 1156e41f4b71Sopenharmony_ci| -------------- | -------------------------------------- | 1157e41f4b71Sopenharmony_ci| Promise\<[Want](js-apis-application-want.md)> | Promise used to return the **Want** object.| 1158e41f4b71Sopenharmony_ci 1159e41f4b71Sopenharmony_ci**Example** 1160e41f4b71Sopenharmony_ci 1161e41f4b71Sopenharmony_ci```ts 1162e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1163e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 1164e41f4b71Sopenharmony_ci 1165e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 1166e41f4b71Sopenharmony_ci 1167e41f4b71Sopenharmony_cibundle.getLaunchWantForBundle(bundleName) 1168e41f4b71Sopenharmony_ci .then((data) => { 1169e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 1170e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 1171e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1172e41f4b71Sopenharmony_ci }) 1173e41f4b71Sopenharmony_ci``` 1174e41f4b71Sopenharmony_ci 1175e41f4b71Sopenharmony_ci## bundle.getLaunchWantForBundle<sup>deprecated<sup> 1176e41f4b71Sopenharmony_ci 1177e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1178e41f4b71Sopenharmony_ci 1179e41f4b71Sopenharmony_cigetLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void 1180e41f4b71Sopenharmony_ci 1181e41f4b71Sopenharmony_ciObtains the **Want** object that launches the specified application. This API uses an asynchronous callback to return the result. 1182e41f4b71Sopenharmony_ci 1183e41f4b71Sopenharmony_ci**Required permissions** 1184e41f4b71Sopenharmony_ci 1185e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED 1186e41f4b71Sopenharmony_ci 1187e41f4b71Sopenharmony_ci**System capability** 1188e41f4b71Sopenharmony_ci 1189e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1190e41f4b71Sopenharmony_ci 1191e41f4b71Sopenharmony_ci**Parameters** 1192e41f4b71Sopenharmony_ci 1193e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1194e41f4b71Sopenharmony_ci| ---------- | --------------------------------------------------- | ---- | -------------------------------------------------------- | 1195e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 1196e41f4b71Sopenharmony_ci| callback | AsyncCallback\<[Want](js-apis-application-want.md)> | Yes | Callback used to return the **Want** object.| 1197e41f4b71Sopenharmony_ci 1198e41f4b71Sopenharmony_ci**Example** 1199e41f4b71Sopenharmony_ci 1200e41f4b71Sopenharmony_ci```ts 1201e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1202e41f4b71Sopenharmony_ci 1203e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 1204e41f4b71Sopenharmony_ci 1205e41f4b71Sopenharmony_cibundle.getLaunchWantForBundle(bundleName, (err, data) => { 1206e41f4b71Sopenharmony_ci if (err) { 1207e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1208e41f4b71Sopenharmony_ci return; 1209e41f4b71Sopenharmony_ci } 1210e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 1211e41f4b71Sopenharmony_ci}) 1212e41f4b71Sopenharmony_ci``` 1213e41f4b71Sopenharmony_ci 1214e41f4b71Sopenharmony_ci 1215e41f4b71Sopenharmony_ci## bundle.getNameForUid<sup>8+</sup> <sup>deprecated<sup> 1216e41f4b71Sopenharmony_ci 1217e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1218e41f4b71Sopenharmony_ci 1219e41f4b71Sopenharmony_cigetNameForUid(uid: number): Promise\<string> 1220e41f4b71Sopenharmony_ci 1221e41f4b71Sopenharmony_ciObtains the bundle name based on a UID. This API uses a promise to return the result. 1222e41f4b71Sopenharmony_ci 1223e41f4b71Sopenharmony_ci**System capability** 1224e41f4b71Sopenharmony_ci 1225e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1226e41f4b71Sopenharmony_ci 1227e41f4b71Sopenharmony_ci**Parameters** 1228e41f4b71Sopenharmony_ci 1229e41f4b71Sopenharmony_ci| Name| Type | Mandatory| Description | 1230e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ------------- | 1231e41f4b71Sopenharmony_ci| uid | number | Yes | UID based on which the bundle name is to obtain.| 1232e41f4b71Sopenharmony_ci 1233e41f4b71Sopenharmony_ci**Return value** 1234e41f4b71Sopenharmony_ci| Type | Description | 1235e41f4b71Sopenharmony_ci| ---------------- | --------------------------------- | 1236e41f4b71Sopenharmony_ci| Promise\<string> | Promise used to return the bundle name.| 1237e41f4b71Sopenharmony_ci 1238e41f4b71Sopenharmony_ci**Example** 1239e41f4b71Sopenharmony_ci 1240e41f4b71Sopenharmony_ci```ts 1241e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1242e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 1243e41f4b71Sopenharmony_ci 1244e41f4b71Sopenharmony_cilet uid: number = 20010005; 1245e41f4b71Sopenharmony_ci 1246e41f4b71Sopenharmony_cibundle.getNameForUid(uid) 1247e41f4b71Sopenharmony_ci .then((data) => { 1248e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 1249e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 1250e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1251e41f4b71Sopenharmony_ci }) 1252e41f4b71Sopenharmony_ci``` 1253e41f4b71Sopenharmony_ci 1254e41f4b71Sopenharmony_ci## bundle.getNameForUid<sup>8+</sup> <sup>deprecated<sup> 1255e41f4b71Sopenharmony_ci 1256e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. 1257e41f4b71Sopenharmony_ci 1258e41f4b71Sopenharmony_cigetNameForUid(uid: number, callback: AsyncCallback\<string>) : void 1259e41f4b71Sopenharmony_ci 1260e41f4b71Sopenharmony_ciObtains the bundle name based on a UID. This API uses an asynchronous callback to return the result. 1261e41f4b71Sopenharmony_ci 1262e41f4b71Sopenharmony_ci**System capability** 1263e41f4b71Sopenharmony_ci 1264e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1265e41f4b71Sopenharmony_ci 1266e41f4b71Sopenharmony_ci**Parameters** 1267e41f4b71Sopenharmony_ci 1268e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1269e41f4b71Sopenharmony_ci| -------- | ---------------------- | ---- | ----------------------------------------------------- | 1270e41f4b71Sopenharmony_ci| uid | number | Yes | UID based on which the bundle name is to obtain. | 1271e41f4b71Sopenharmony_ci| callback | AsyncCallback\<string> | Yes | Callback used to return the bundle name.| 1272e41f4b71Sopenharmony_ci 1273e41f4b71Sopenharmony_ci**Example** 1274e41f4b71Sopenharmony_ci 1275e41f4b71Sopenharmony_ci```ts 1276e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1277e41f4b71Sopenharmony_ci 1278e41f4b71Sopenharmony_cilet uid: number = 20010005; 1279e41f4b71Sopenharmony_ci 1280e41f4b71Sopenharmony_cibundle.getNameForUid(uid, (err, data) => { 1281e41f4b71Sopenharmony_ci if (err) { 1282e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1283e41f4b71Sopenharmony_ci return; 1284e41f4b71Sopenharmony_ci } 1285e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 1286e41f4b71Sopenharmony_ci}) 1287e41f4b71Sopenharmony_ci``` 1288e41f4b71Sopenharmony_ci 1289e41f4b71Sopenharmony_ci 1290e41f4b71Sopenharmony_ci## bundle.getAbilityIcon<sup>8+</sup> <sup>deprecated<sup> 1291e41f4b71Sopenharmony_ci 1292e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](../apis-localization-kit/js-apis-resource-manager.md#getmediacontent9) instead. 1293e41f4b71Sopenharmony_ci 1294e41f4b71Sopenharmony_cigetAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap> 1295e41f4b71Sopenharmony_ci 1296e41f4b71Sopenharmony_ciObtains the [pixel map](../apis-image-kit/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. 1297e41f4b71Sopenharmony_ci 1298e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 1299e41f4b71Sopenharmony_ci 1300e41f4b71Sopenharmony_ci**Required permissions** 1301e41f4b71Sopenharmony_ci 1302e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1303e41f4b71Sopenharmony_ci 1304e41f4b71Sopenharmony_ci**System capability** 1305e41f4b71Sopenharmony_ci 1306e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1307e41f4b71Sopenharmony_ci 1308e41f4b71Sopenharmony_ci**Parameters** 1309e41f4b71Sopenharmony_ci 1310e41f4b71Sopenharmony_ci| Name | Type | Mandatory| Description | 1311e41f4b71Sopenharmony_ci| ----------- | ------ | ---- | ------------------------ | 1312e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name.| 1313e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name. | 1314e41f4b71Sopenharmony_ci 1315e41f4b71Sopenharmony_ci**Return value** 1316e41f4b71Sopenharmony_ci| Type | Description | 1317e41f4b71Sopenharmony_ci| --------------------- | ------------------------------------------------------------ | 1318e41f4b71Sopenharmony_ci| Promise\<image.PixelMap> | Promise used to return the [pixel map](../apis-image-kit/js-apis-image.md).| 1319e41f4b71Sopenharmony_ci 1320e41f4b71Sopenharmony_ci**Example** 1321e41f4b71Sopenharmony_ci 1322e41f4b71Sopenharmony_ci```ts 1323e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1324e41f4b71Sopenharmony_ciimport { BusinessError } from '@ohos.base'; 1325e41f4b71Sopenharmony_ci 1326e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 1327e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 1328e41f4b71Sopenharmony_ci 1329e41f4b71Sopenharmony_cibundle.getAbilityIcon(bundleName, abilityName) 1330e41f4b71Sopenharmony_ci .then((data) => { 1331e41f4b71Sopenharmony_ci console.info('Operation successful. Data: ' + JSON.stringify(data)); 1332e41f4b71Sopenharmony_ci }).catch((error: BusinessError) => { 1333e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(error)); 1334e41f4b71Sopenharmony_ci }) 1335e41f4b71Sopenharmony_ci``` 1336e41f4b71Sopenharmony_ci 1337e41f4b71Sopenharmony_ci## bundle.getAbilityIcon<sup>8+</sup> <sup>deprecated<sup> 1338e41f4b71Sopenharmony_ci 1339e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [resourceManager.getMediaContent](../apis-localization-kit/js-apis-resource-manager.md#getmediacontent9) instead. 1340e41f4b71Sopenharmony_ci 1341e41f4b71Sopenharmony_cigetAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void 1342e41f4b71Sopenharmony_ci 1343e41f4b71Sopenharmony_ciObtains the [pixel map](../apis-image-kit/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. 1344e41f4b71Sopenharmony_ci 1345e41f4b71Sopenharmony_ciNo permission is required for obtaining the caller's own information. 1346e41f4b71Sopenharmony_ci 1347e41f4b71Sopenharmony_ci**Required permissions** 1348e41f4b71Sopenharmony_ci 1349e41f4b71Sopenharmony_ciohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO 1350e41f4b71Sopenharmony_ci 1351e41f4b71Sopenharmony_ci 1352e41f4b71Sopenharmony_ci**System capability** 1353e41f4b71Sopenharmony_ci 1354e41f4b71Sopenharmony_ciSystemCapability.BundleManager.BundleFramework 1355e41f4b71Sopenharmony_ci 1356e41f4b71Sopenharmony_ci**Parameters** 1357e41f4b71Sopenharmony_ci 1358e41f4b71Sopenharmony_ci| Name | Type | Mandatory | Description | 1359e41f4b71Sopenharmony_ci| ----------- | ---------------------------------------- | ---- |-------------------------------------------------| 1360e41f4b71Sopenharmony_ci| bundleName | string | Yes | Bundle name. | 1361e41f4b71Sopenharmony_ci| abilityName | string | Yes | Ability name. | 1362e41f4b71Sopenharmony_ci| callback | AsyncCallback\<image.PixelMap> | Yes | Callback used to return the [pixel map](../apis-image-kit/js-apis-image.md).| 1363e41f4b71Sopenharmony_ci 1364e41f4b71Sopenharmony_ci**Example** 1365e41f4b71Sopenharmony_ci 1366e41f4b71Sopenharmony_ci```ts 1367e41f4b71Sopenharmony_ciimport bundle from '@ohos.bundle'; 1368e41f4b71Sopenharmony_ci 1369e41f4b71Sopenharmony_cilet bundleName: string = "com.example.myapplication"; 1370e41f4b71Sopenharmony_cilet abilityName: string = "EntryAbility"; 1371e41f4b71Sopenharmony_ci 1372e41f4b71Sopenharmony_cibundle.getAbilityIcon(bundleName, abilityName, (err, data) => { 1373e41f4b71Sopenharmony_ci if (err) { 1374e41f4b71Sopenharmony_ci console.error('Operation failed. Cause: ' + JSON.stringify(err)); 1375e41f4b71Sopenharmony_ci return; 1376e41f4b71Sopenharmony_ci } 1377e41f4b71Sopenharmony_ci console.info('Operation successful. Data:' + JSON.stringify(data)); 1378e41f4b71Sopenharmony_ci}) 1379e41f4b71Sopenharmony_ci``` 1380e41f4b71Sopenharmony_ci 1381e41f4b71Sopenharmony_ci## InstallErrorCode<sup>deprecated<sup> 1382e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are not advised using it anymore. 1383e41f4b71Sopenharmony_ci 1384e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1385e41f4b71Sopenharmony_ci 1386e41f4b71Sopenharmony_ci| Name | Value | Description | 1387e41f4b71Sopenharmony_ci| ---------------------------------------------------- | ---- | ------------------------------------------------ | 1388e41f4b71Sopenharmony_ci| SUCCESS | 0 | Installation succeeded. | 1389e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE | 1 | Installation failed. (The application to be installed is not found.) | 1390e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_ABORTED | 2 | Installation aborted. | 1391e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_INVALID | 3 | Invalid installation parameter. | 1392e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_CONFLICT | 4 | Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.) | 1393e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_STORAGE | 5 | Failed to store the bundle information. | 1394e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_INCOMPATIBLE | 6 | Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)| 1395e41f4b71Sopenharmony_ci| STATUS_UNINSTALL_FAILURE | 7 | Uninstallation failed. (The application to be uninstalled is not found.) | 1396e41f4b71Sopenharmony_ci| STATUS_UNINSTALL_FAILURE_BLOCKED | 8 | Uninstallation aborted. (This error code is not in use.) | 1397e41f4b71Sopenharmony_ci| STATUS_UNINSTALL_FAILURE_ABORTED | 9 | Uninstallation aborted. (Invalid parameters.) | 1398e41f4b71Sopenharmony_ci| STATUS_UNINSTALL_FAILURE_CONFLICT | 10 | Uninstallation conflict. (Failed to uninstall a system application or end the application process.)| 1399e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT | 0x0B | Installation failed. (Download timed out.) | 1400e41f4b71Sopenharmony_ci| STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED | 0x0C | Installation failed. (Download failed.) | 1401e41f4b71Sopenharmony_ci| STATUS_RECOVER_FAILURE_INVALID<sup>8+</sup> | 0x0D | Failed to restore the pre-installed application. | 1402e41f4b71Sopenharmony_ci| STATUS_ABILITY_NOT_FOUND | 0x40 | Ability not found. | 1403e41f4b71Sopenharmony_ci| STATUS_BMS_SERVICE_ERROR | 0x41 | BMS service error. | 1404e41f4b71Sopenharmony_ci| STATUS_FAILED_NO_SPACE_LEFT<sup>8+</sup> | 0x42 | Insufficient device space. | 1405e41f4b71Sopenharmony_ci| STATUS_GRANT_REQUEST_PERMISSIONS_FAILED<sup>8+</sup> | 0x43 | Application authorization failed. | 1406e41f4b71Sopenharmony_ci| STATUS_INSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x44 | No installation permission. | 1407e41f4b71Sopenharmony_ci| STATUS_UNINSTALL_PERMISSION_DENIED<sup>8+</sup> | 0x45 | No uninstallation permission. | 1408e41f4b71Sopenharmony_ci 1409e41f4b71Sopenharmony_ci## BundleFlag<sup>deprecated<sup> 1410e41f4b71Sopenharmony_ci 1411e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [bundleManager.BundleFlag](js-apis-bundleManager.md#bundleflag) instead. 1412e41f4b71Sopenharmony_ci 1413e41f4b71Sopenharmony_ciEnumerates the bundle flags, which indicate the type of bundle information to obtain. 1414e41f4b71Sopenharmony_ci 1415e41f4b71Sopenharmony_ciIf an API does not match the flag, the flag is ignored. For example, using **GET_ABILITY_INFO_WITH_PERMISSION** to obtain the application information does not affect the result. 1416e41f4b71Sopenharmony_ci 1417e41f4b71Sopenharmony_ciFlags can be used together. For example, you can use the combination of **GET_APPLICATION_INFO_WITH_PERMISSION** and **GET_APPLICATION_INFO_WITH_DISABLE** to obtain the result that contains both application permission information and disabled application information. 1418e41f4b71Sopenharmony_ci 1419e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1420e41f4b71Sopenharmony_ci 1421e41f4b71Sopenharmony_ci| Name | Value | Description | 1422e41f4b71Sopenharmony_ci| ----------------------------------------------- | ---------- | ------------------------------- | 1423e41f4b71Sopenharmony_ci| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information. | 1424e41f4b71Sopenharmony_ci| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information. | 1425e41f4b71Sopenharmony_ci| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information. | 1426e41f4b71Sopenharmony_ci| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information. | 1427e41f4b71Sopenharmony_ci| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information. | 1428e41f4b71Sopenharmony_ci| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions. | 1429e41f4b71Sopenharmony_ci| GET_ABILITY_INFO_WITH_METADATA<sup>8+</sup> | 0x00000020 | Obtains the ability metadata information. | 1430e41f4b71Sopenharmony_ci| GET_APPLICATION_INFO_WITH_METADATA<sup>8+</sup> | 0x00000040 | Obtains the application metadata information. | 1431e41f4b71Sopenharmony_ci| GET_ABILITY_INFO_SYSTEMAPP_ONLY<sup>8+</sup> | 0x00000080 | Obtains the ability information of system applications.| 1432e41f4b71Sopenharmony_ci| GET_ABILITY_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000100 | Obtains information about disabled abilities. | 1433e41f4b71Sopenharmony_ci| GET_APPLICATION_INFO_WITH_DISABLE<sup>8+</sup> | 0x00000200 | Obtains information about disabled applications. | 1434e41f4b71Sopenharmony_ci| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information. | 1435e41f4b71Sopenharmony_ci 1436e41f4b71Sopenharmony_ci## BundleOptions<sup>deprecated<sup> 1437e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are not advised using it anymore. 1438e41f4b71Sopenharmony_ci 1439e41f4b71Sopenharmony_ciOptions that contain the user ID. 1440e41f4b71Sopenharmony_ci 1441e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1442e41f4b71Sopenharmony_ci 1443e41f4b71Sopenharmony_ci| Name | Type | Read-Only| Optional| Description | 1444e41f4b71Sopenharmony_ci| ------ | ------ | ---- | ---- | ----------------------------------------------------- | 1445e41f4b71Sopenharmony_ci| userId | number | No | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.| 1446e41f4b71Sopenharmony_ci 1447e41f4b71Sopenharmony_ci## AbilityType<sup>deprecated<sup> 1448e41f4b71Sopenharmony_ci 1449e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [bundleManager.AbilityType](js-apis-bundleManager.md#abilitytype) instead. 1450e41f4b71Sopenharmony_ci 1451e41f4b71Sopenharmony_ciEnumerates the ability types. 1452e41f4b71Sopenharmony_ci 1453e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1454e41f4b71Sopenharmony_ci 1455e41f4b71Sopenharmony_ci| Name| Value| Description | 1456e41f4b71Sopenharmony_ci| ------- | ---- | --------------------------- | 1457e41f4b71Sopenharmony_ci| UNKNOWN | None | Unknown ability type. | 1458e41f4b71Sopenharmony_ci| PAGE | None | FA developed using the Page template to provide the capability of interacting with users. | 1459e41f4b71Sopenharmony_ci| SERVICE | None | PA developed using the Service template to provide the capability of running tasks in the background. | 1460e41f4b71Sopenharmony_ci| DATA | None | PA developed using the Data template to provide unified data access for external systems.| 1461e41f4b71Sopenharmony_ci 1462e41f4b71Sopenharmony_ci## DisplayOrientation<sup>deprecated<sup> 1463e41f4b71Sopenharmony_ci 1464e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [bundleManager.DisplayOrientation](js-apis-bundleManager.md#displayorientation) instead. 1465e41f4b71Sopenharmony_ci 1466e41f4b71Sopenharmony_ciEnumerates display orientations. 1467e41f4b71Sopenharmony_ci 1468e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1469e41f4b71Sopenharmony_ci 1470e41f4b71Sopenharmony_ci| Name | Value | Description | 1471e41f4b71Sopenharmony_ci| ------------- | ---- | ------------------------ | 1472e41f4b71Sopenharmony_ci| UNSPECIFIED | None | Unspecified display orientation. | 1473e41f4b71Sopenharmony_ci| LANDSCAPE | None | Landscape orientation. | 1474e41f4b71Sopenharmony_ci| PORTRAIT | None | Portrait orientation. | 1475e41f4b71Sopenharmony_ci| FOLLOW_RECENT | None | Orientation same as that of the nearest ability in the stack.| 1476e41f4b71Sopenharmony_ci## LaunchMode<sup>deprecated<sup> 1477e41f4b71Sopenharmony_ci 1478e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [bundleManager.LaunchType](js-apis-bundleManager.md#launchtype) instead. 1479e41f4b71Sopenharmony_ci 1480e41f4b71Sopenharmony_ciEnumerates the ability launch modes. 1481e41f4b71Sopenharmony_ci 1482e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1483e41f4b71Sopenharmony_ci 1484e41f4b71Sopenharmony_ci| Name | Value | Description | 1485e41f4b71Sopenharmony_ci| --------- | ---- | ------------------- | 1486e41f4b71Sopenharmony_ci| SINGLETON | 0 | The ability has only one instance.| 1487e41f4b71Sopenharmony_ci| STANDARD | 1 | The ability can have multiple instances. | 1488e41f4b71Sopenharmony_ci 1489e41f4b71Sopenharmony_ci## AbilitySubType<sup>deprecated<sup> 1490e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are not advised using it anymore. 1491e41f4b71Sopenharmony_ci 1492e41f4b71Sopenharmony_ciEnumerates the ability subtypes. 1493e41f4b71Sopenharmony_ci 1494e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1495e41f4b71Sopenharmony_ci 1496e41f4b71Sopenharmony_ci| Name | Value | Description | 1497e41f4b71Sopenharmony_ci| ----------- | ---- | ----------------------------- | 1498e41f4b71Sopenharmony_ci| UNSPECIFIED | 0 | Undefined ability subtype. | 1499e41f4b71Sopenharmony_ci| CA | 1 | Ability that has a UI.| 1500e41f4b71Sopenharmony_ci 1501e41f4b71Sopenharmony_ci## ColorMode<sup>deprecated<sup> 1502e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are not advised using it anymore. 1503e41f4b71Sopenharmony_ci 1504e41f4b71Sopenharmony_ciEnumerates the color modes of applications and widgets. 1505e41f4b71Sopenharmony_ci 1506e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1507e41f4b71Sopenharmony_ci 1508e41f4b71Sopenharmony_ci| Name | Value | Description | 1509e41f4b71Sopenharmony_ci| ---------- | ---- | -------- | 1510e41f4b71Sopenharmony_ci| AUTO_MODE | -1 | Automatic mode.| 1511e41f4b71Sopenharmony_ci| DARK_MODE | 0 | Dark mode.| 1512e41f4b71Sopenharmony_ci| LIGHT_MODE | 1 | Light mode.| 1513e41f4b71Sopenharmony_ci 1514e41f4b71Sopenharmony_ci 1515e41f4b71Sopenharmony_ci## GrantStatus<sup>deprecated<sup> 1516e41f4b71Sopenharmony_ci 1517e41f4b71Sopenharmony_ci> This API is deprecated since API version 9. You are advised to use [bundleManager.PermissionGrantState](js-apis-bundleManager.md#permissiongrantstate) instead. 1518e41f4b71Sopenharmony_ci 1519e41f4b71Sopenharmony_ciEnumerates the permission grant states. 1520e41f4b71Sopenharmony_ci 1521e41f4b71Sopenharmony_ci **System capability**: SystemCapability.BundleManager.BundleFramework 1522e41f4b71Sopenharmony_ci 1523e41f4b71Sopenharmony_ci| Name | Value | Description | 1524e41f4b71Sopenharmony_ci| ------------------ | ---- | ------------ | 1525e41f4b71Sopenharmony_ci| PERMISSION_DENIED | -1 | Permission denied.| 1526e41f4b71Sopenharmony_ci| PERMISSION_GRANTED | 0 | Permission granted. | 1527