HarmonyOS鸿蒙Next中如何查询设备的SDK版本等信息

HarmonyOS鸿蒙Next中如何查询设备的SDK版本等信息 解决措施

使用deviceInfo模块获取SDK版本等信息。

import { deviceInfo } from '@kit.BasicServicesKit';

let distributionOSApiVersion: number = deviceInfo.distributionOSApiVersion;

console.info('the value of the deviceinfo distributionOSApiVersion is :' + distributionOSApiVersion);

参考链接

deviceInfo (设备信息)


更多关于HarmonyOS鸿蒙Next中如何查询设备的SDK版本等信息的实战教程也可以访问 https://www.itying.com/category-93-b0.html

1 回复

更多关于HarmonyOS鸿蒙Next中如何查询设备的SDK版本等信息的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


在HarmonyOS鸿蒙Next中,可以通过ohos.system.DeviceInfo模块查询设备的SDK版本等信息。使用getSystemInfoSync()方法获取系统信息对象,从中提取sdkVersion属性即可获取SDK版本。示例代码如下:

import deviceInfo from '@ohos.system.deviceInfo';

let systemInfo = deviceInfo.getSystemInfoSync();
let sdkVersion = systemInfo.sdkVersion;
console.log("SDK Version: " + sdkVersion);

此外,systemInfo对象还包含其他设备信息,如设备型号、系统版本等。

回到顶部