diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index e16569423641034f8c51701b00f8fd0176f311d7..53201553d145db6b58f9f716f680b7b3a3cf4899 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -3303,4 +3303,38 @@ try { } catch (error) { console.error('getAdditionalInfo failed. Cause: ' + error.message); } +``` + +### bundleManager.getBundleInfoForSelfSync10+ + +getBundleInfoForSelfSync(bundleFlags: number): BundleInfo; + +以同步方法根据给定的bundleFlags获取当前应用的BundleInfo。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------- | +| bundleFlags | [number](#bundleflag) | 是 | 指定返回的BundleInfo所包含的信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------- | -------------------- | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象。 | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION; +try { + let data = bundleManager.getBundleInfoForSelfSync(bundleFlags); + hilog.info(0x0000, 'testTag', 'getBundleInfoForSelfSync successfully: %{public}s', JSON.stringify(data)); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getBundleInfoForSelfSync failed: %{public}s', err.message); +} ``` \ No newline at end of file