admin管理员组

文章数量:1629912

关键字

设备管理 / @ohos.deviceInfo设备信息模块 / 电量 / 内存 / IP地址 / 网卡

问题描述

如何获取手机系统版本和系统名称?

解决方案

可通过@ohos.deviceInfo(设备信息)模块获取手机系统版本和系统名称。

详细说明请参考文档:https://developer.huawei/consumer/cn/doc/harmonyos-references/js-apis-device-info-0000001820881301

另外,附上获取其它设备参数的方法供您参考:

  • 电量

    可通过@ohos.batteryInfo(电量信息)模块获取

    参考文档:https://developer.huawei/consumer/cn/doc/harmonyos-references/js-apis-battery-info-0000001774121658

  • 总运行内存&可用运行内存

    可通过@ohos.hidebug(Debug调试)模块获取

    hidebug.getNativeHeapSize getNativeHeapSize(): bigint 获取native heap内存的总大小。

    hidebug.getNativeHeapFreeSize getNativeHeapFreeSize(): bigint 获取native heap内存的空闲内存大小。

    参考文档:https://developer.huawei/consumer/cn/doc/harmonyos-references/js-apis-hidebug-0000001774281566#ZH-CN_TOPIC_0000001774281566

  • IP地址&网卡

    可通过@ohos.connection (网络连接管理)模块的ConnectionProperties获取。

    参考文档:https://developer.huawei/consumer/cn/doc/harmonyos-references/js-apis-net-connection-0000001774281662#ZH-CN_TOPIC_0000001774281662__connectionproperties

本文标签: 系统名称版本手机harmonyos