harmony 鸿蒙@ohos.deviceInfo (设备信息)

2022-08-09 浏览 (1291)

@ohos.deviceInfo (设备信息)

本模块提供产品信息。

说明:

本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

导入模块

import deviceInfo from '@ohos.deviceInfo'

属性

系统能力:SystemCapability.Startup.SystemInfo。

权限:以下各项所需要的权限有所不同,详见下表。

名称类型可读可写说明
deviceTypestring是否设备类型。
manufacturestring是否设备厂家名称。
brandstring是否设备品牌名称。
marketNamestring是否外部产品系列。
productSeriesstring是否产品系列。
productModelstring是否认证型号。
softwareModelstring是否内部软件子型号。
hardwareModelstring是否硬件版本号。
hardwareProfilestring是否硬件Profile。
serialstring是否设备序列号。
需要权限:ohos.permission.sec.ACCESS_UDID
bootloaderVersionstring是否Bootloader版本号。
abiListstring是否应用二进制接口(Abi)列表。
securityPatchTagstring是否安全补丁级别。
displayVersionstring是否产品版本。
incrementalVersionstring是否差异版本号。
osReleaseTypestring是否系统的发布类型,取值为:
- Canary:面向特定开发者发布的早期预览版本,不承诺API稳定性。
- Beta:面向开发者公开发布的Beta版本,不承诺API稳定性。
- Release:面向开发者公开发布的正式版本,承诺API稳定性。
osFullNamestring是否系统版本。
majorVersionnumber是否Major版本号,随主版本更新增加。
seniorVersionnumber是否Senior版本号,随局部架构、重大特性增加。
featureVersionnumber是否Feature版本号,标识规划的新特性版本。
buildVersionnumber是否Build版本号,标识编译构建的版本号。
sdkApiVersionnumber是否系统软件API版本。
firstApiVersionnumber是否首个版本系统软件API版本。
versionIdstring是否版本ID。
buildTypestring是否构建类型。
buildUserstring是否构建用户。
buildHoststring是否构建主机。
buildTimestring是否构建时间。
buildRootHashstring是否构建版本Hash。
udid7+string是否设备Udid。
需要权限:ohos.permission.sec.ACCESS_UDID
distributionOSName10+String是否发行版系统名称。
distributionOSVersion10+String是否发行版系统版本号。
distributionOSApiVersion10+number是否发行版系统api版本。
distributionOSReleaseType10+String是否发行版系统类型。

示例

    import deviceinfo from '@ohos.deviceInfo'

    let deviceTypeInfo: string = deviceinfo.deviceType;
    console.info('the value of the deviceType is :' + deviceTypeInfo);

    let manufactureInfo: string = deviceinfo.manufacture;
    console.info('the value of the manufactureInfo is :' + manufactureInfo);

    let brandInfo: string = deviceinfo.brand;
    console.info('the value of the device brand is :' + brandInfo);

    let marketNameInfo: string = deviceinfo.marketName;
    console.info('the value of the deviceinfo marketName is :' + marketNameInfo);

    let productSeriesInfo: string = deviceinfo.productSeries;
    console.info('the value of the deviceinfo productSeries is :' + productSeriesInfo);

    let productModelInfo: string = deviceinfo.productModel;
    console.info('the value of the deviceinfo productModel is :' + productModelInfo);

    let softwareModelInfo: string = deviceinfo.softwareModel;
    console.info('the value of the deviceinfo softwareModel is :' + softwareModelInfo);

    let hardwareModelInfo: string = deviceinfo.hardwareModel;
    console.info('the value of the deviceinfo hardwareModel is :' + hardwareModelInfo);

    let hardwareProfileInfo: string = deviceinfo.hardwareProfile;
    console.info('the value of the deviceinfo hardwareProfile is :' + hardwareProfileInfo);

    let serialInfo: string = deviceinfo.serial;
    console.info('the value of the deviceinfo serial is :' + serialInfo);

    let bootloaderVersionInfo: string = deviceinfo.bootloaderVersion;
    console.info('the value of the deviceinfo bootloaderVersion is :' + bootloaderVersionInfo);

    let abiListInfo: string = deviceinfo.abiList;
    console.info('the value of the deviceinfo abiList is :' + abiListInfo);

    let securityPatchTagInfo: string = deviceinfo.securityPatchTag;
    console.info('the value of the deviceinfo securityPatchTag is :' + securityPatchTagInfo);

    let displayVersionInfo: string = deviceinfo.displayVersion;
    console.info('the value of the deviceinfo displayVersion is :' + displayVersionInfo);

    let incrementalVersionInfo: string = deviceinfo.incrementalVersion;
    console.info('the value of the deviceinfo incrementalVersion is :' + incrementalVersionInfo);

    let osReleaseTypeInfo: string = deviceinfo.osReleaseType;
    console.info('the value of the deviceinfo osReleaseType is :' + osReleaseTypeInfo);

    let osFullNameInfo: string = deviceinfo.osFullName;
    console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo);

    let majorVersionInfo: number = deviceinfo.majorVersion;
    console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo);

    let seniorVersionInfo: number = deviceinfo.seniorVersion;
    console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo);

    let featureVersionInfo: number = deviceinfo.featureVersion;
    console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo);

    let buildVersionInfo: number = deviceinfo.buildVersion;
    console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo);

    let sdkApiVersionInfo: number = deviceinfo.sdkApiVersion;
    console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo);

    let firstApiVersionInfo: number = deviceinfo.firstApiVersion;
    console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo);

    let versionIdInfo: string = deviceinfo.versionId;
    console.info('the value of the deviceinfo versionId is :' + versionIdInfo);

    let buildTypeInfo: string = deviceinfo.buildType;
    console.info('the value of the deviceinfo buildType is :' + buildTypeInfo);

    let buildUserInfo: string = deviceinfo.buildUser;
    console.info('the value of the deviceinfo buildUser is :' + buildUserInfo);

    let buildHostInfo: string = deviceinfo.buildHost;
    console.info('the value of the deviceinfo buildHost is :' + buildHostInfo);

    let buildTimeInfo: string = deviceinfo.buildTime;
    console.info('the value of the deviceinfo buildTime is :' + buildTimeInfo);

    let buildRootHashInfo: string = deviceinfo.buildRootHash;
    console.info('the value of the deviceinfo buildRootHash is :' + buildRootHashInfo);

    let udid: string = deviceinfo.udid;
    console.info('the value of the deviceinfo udid is :' + udid);

    let distributionOSName: string = deviceinfo.distributionOSName
    console.info('the value of the deviceinfo distributionOSName is :' + distributionOSName);

    let distributionOSVersion: string = deviceinfo.distributionOSVersion
    console.info('the value of the deviceinfo distributionOSVersion is :' + distributionOSVersion);

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

    let distributionOSReleaseType: string = deviceinfo.distributionOSReleaseType
    console.info('the value of the deviceinfo distributionOSReleaseType is :' + distributionOSReleaseType);

你可能感兴趣的鸿蒙文章

harmony 鸿蒙接口

harmony 鸿蒙系统公共事件定义(待停用)

harmony 鸿蒙系统公共事件定义

harmony 鸿蒙开发说明

harmony 鸿蒙企业设备管理概述(仅对系统应用开放)

harmony 鸿蒙BundleStatusCallback

harmony 鸿蒙@ohos.bundle.innerBundleManager (innerBundleManager模块)

harmony 鸿蒙@ohos.distributedBundle (分布式包管理)

harmony 鸿蒙@ohos.bundle (Bundle模块)

harmony 鸿蒙@ohos.enterprise.EnterpriseAdminExtensionAbility (企业设备管理扩展能力)

  • 所属分类: 后端技术
  • 本文标签: 鸿蒙 软件
  • 版权声明: 本文链接 https://seaxiang.com/blog/cbc00b6cfc464e768dc8fe62c67d4f03