You can obtain the bundle information, including the application version number and version name, through the bundleManager module in @kit.AbilityKit.import { BusinessError } from '@kit.BasicServicesKit';
import { bundleManager } from '@kit.AbilityKit';
// ...
bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then((bundleInfo) => {
let versionName = bundleInfo.versionName; //App version name
let versionNo = bundleInfo.versionCode; //App version code
}).catch((error: BusinessError) => {
console.error('get bundleInfo failed, error is ' + error);
})