HarmonyOS 如何获取app当前的versionCode设备唯一标识码

app当前版本号调用的deviceInfo.buildVersion,但是返回结果始终是0,怎样获取app当前的versionCode设备唯一标识码?

HarmonyOS
2024-12-25 10:55:58
6473浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

获取app当前的versionCode参考链接:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-bundlemanager-V5#bundlemanagergetbundleinfoforself

参考示例:

DeviceUtil.getInfoV2().then((bundleInfo: bundleManager.BundleInfo) => {
  let version: number = bundleInfo.versionCode
  console.log('version' + version)
  const apiClient = axios.create({
    baseURL: 'https://api.btime.com/',
    timeout: 1000,
    headers: { 'User-Agent': 'bjtime', 'Referer': 'harmony-app.btime.com' }
  });

  apiClient.interceptors.request.use((config: InternalAxiosRequestConfig) => {
    if (!config.params) {
      config.params = {}
    }
    config.params['channel'] = 'huawei_harmony';
    config.params['os'] = deviceInfo.productModel;
    config.params['os_ver'] = deviceInfo.osFullName;
    config.params['os_type'] = 'Harmony';
    config.params['carrier'] = '';
    config.params['token'] = deviceInfo.serial;
    config.params['sid'] = '';
    config.params['timestamp'] = '';
    config.params['src'] = 'lx_harmony';
    config.params['net'] = '';
    config.params['push_id'] = '';
    config.params['push_switch'] = '';
    config.params['location_citycode'] = '';

    return config;
  }, (error: AxiosError) => {
    return Promise.reject(error);
  });
})
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
分享
微博
QQ
微信
回复
2024-12-25 13:21:19
相关问题
HarmonyOS 如何获取设备唯一标识
1122浏览 • 2回复 待解决
如何获取设备唯一标识
2646浏览 • 1回复 待解决
如何获取设备唯一标识
2722浏览 • 1回复 待解决
HarmonyOS 获取设备唯一标识
1939浏览 • 1回复 待解决
如何HarmonyOS唯一标识设备
1493浏览 • 1回复 待解决
如何获取对象唯一标识(Hash值)
1556浏览 • 1回复 待解决
HarmonyOS 如何获取设备唯一ID?
1372浏览 • 0回复 待解决
是否支持获取唯一设备ID?
997浏览 • 1回复 待解决
HarmonyOS 开发中获取设备唯一id方式
1919浏览 • 1回复 待解决
求大佬告知设备唯一id如何获取
2668浏览 • 1回复 待解决
富鸿蒙开发如何获取设备唯一Id?
16297浏览 • 1回复 待解决
HarmonyOS无感获取设备标识
1127浏览 • 1回复 待解决
HarmonyOS 如何获取手机唯一 ID?
1153浏览 • 2回复 待解决
如何获取当前设备设备名称
3635浏览 • 1回复 待解决
如何获取当前设备宽度?
1533浏览 • 1回复 待解决
设备唯一id相关问题咨询
2642浏览 • 1回复 待解决