1# @ohos.deviceInfo (设备信息) 2 3本模块提供产品信息。 4 5> **说明:** 6> 7> 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 8 9## 导入模块 10 11```ts 12import deviceInfo from '@ohos.deviceInfo' 13``` 14 15## 属性 16 17**系统能力**:SystemCapability.Startup.SystemInfo。 18 19**权限**:以下各项所需要的权限有所不同,详见下表。 20 21| 名称 | 类型 | 可读 | 可写 | 说明 | 22| -------- | -------- | -------- | -------- | -------- | 23| deviceType | string | 是 | 否 | 设备类型。 | 24| manufacture | string | 是 | 否 | 设备厂家名称。 | 25| brand | string | 是 | 否 | 设备品牌名称。 | 26| marketName | string | 是 | 否 | 外部产品系列。 | 27| productSeries | string | 是 | 否 | 产品系列。 | 28| productModel | string | 是 | 否 | 认证型号。 | 29| softwareModel | string | 是 | 否 | 内部软件子型号。 | 30| hardwareModel | string | 是 | 否 | 硬件版本号。 | 31| hardwareProfile | string | 是 | 否 | 硬件Profile。 | 32| serial | string | 是 | 否 | 设备序列号。<br/>**需要权限**:ohos.permission.sec.ACCESS_UDID | 33| bootloaderVersion | string | 是 | 否 | Bootloader版本号。 | 34| abiList | string | 是 | 否 | 应用二进制接口(Abi)列表。 | 35| securityPatchTag | string | 是 | 否 | 安全补丁级别。 | 36| displayVersion | string | 是 | 否 | 产品版本。 | 37| incrementalVersion | string | 是 | 否 | 差异版本号。 | 38| osReleaseType | string | 是 | 否 | 系统的发布类型,取值为:<br/>- Canary:面向特定开发者发布的早期预览版本,不承诺API稳定性。<br/>- Beta:面向开发者公开发布的Beta版本,不承诺API稳定性。<br/>- Release:面向开发者公开发布的正式版本,承诺API稳定性。 | 39| osFullName | string | 是 | 否 | 系统版本。 | 40| majorVersion | number | 是 | 否 | Major版本号,随主版本更新增加。 | 41| seniorVersion | number | 是 | 否 | Senior版本号,随局部架构、重大特性增加。 | 42| featureVersion | number | 是 | 否 | Feature版本号,标识规划的新特性版本。 | 43| buildVersion | number | 是 | 否 | Build版本号,标识编译构建的版本号。 | 44| sdkApiVersion | number | 是 | 否 | 系统软件API版本。 | 45| firstApiVersion | number | 是 | 否 | 首个版本系统软件API版本。 | 46| versionId | string | 是 | 否 | 版本ID。 | 47| buildType | string | 是 | 否 | 构建类型。 | 48| buildUser | string | 是 | 否 | 构建用户。 | 49| buildHost | string | 是 | 否 | 构建主机。 | 50| buildTime | string | 是 | 否 | 构建时间。 | 51| buildRootHash | string | 是 | 否 | 构建版本Hash。 | 52| udid<sup>7+</sup> | string | 是 | 否 | 设备Udid。<br/>**需要权限**:ohos.permission.sec.ACCESS_UDID| 53| distributionOSName<sup>10+</sup> | String | 是 | 否 | 发行版系统名称。 | 54| distributionOSVersion<sup>10+</sup> | String | 是 | 否 | 发行版系统版本号。 | 55| distributionOSApiVersion<sup>10+</sup> | number| 是 | 否 | 发行版系统api版本。 | 56| distributionOSReleaseType<sup>10+</sup> | String | 是 | 否 | 发行版系统类型。 | 57 58**示例** 59 60```ts 61 import deviceinfo from '@ohos.deviceInfo' 62 63 let deviceTypeInfo: string = deviceinfo.deviceType; 64 console.info('the value of the deviceType is :' + deviceTypeInfo); 65 66 let manufactureInfo: string = deviceinfo.manufacture; 67 console.info('the value of the manufactureInfo is :' + manufactureInfo); 68 69 let brandInfo: string = deviceinfo.brand; 70 console.info('the value of the device brand is :' + brandInfo); 71 72 let marketNameInfo: string = deviceinfo.marketName; 73 console.info('the value of the deviceinfo marketName is :' + marketNameInfo); 74 75 let productSeriesInfo: string = deviceinfo.productSeries; 76 console.info('the value of the deviceinfo productSeries is :' + productSeriesInfo); 77 78 let productModelInfo: string = deviceinfo.productModel; 79 console.info('the value of the deviceinfo productModel is :' + productModelInfo); 80 81 let softwareModelInfo: string = deviceinfo.softwareModel; 82 console.info('the value of the deviceinfo softwareModel is :' + softwareModelInfo); 83 84 let hardwareModelInfo: string = deviceinfo.hardwareModel; 85 console.info('the value of the deviceinfo hardwareModel is :' + hardwareModelInfo); 86 87 let hardwareProfileInfo: string = deviceinfo.hardwareProfile; 88 console.info('the value of the deviceinfo hardwareProfile is :' + hardwareProfileInfo); 89 90 let serialInfo: string = deviceinfo.serial; 91 console.info('the value of the deviceinfo serial is :' + serialInfo); 92 93 let bootloaderVersionInfo: string = deviceinfo.bootloaderVersion; 94 console.info('the value of the deviceinfo bootloaderVersion is :' + bootloaderVersionInfo); 95 96 let abiListInfo: string = deviceinfo.abiList; 97 console.info('the value of the deviceinfo abiList is :' + abiListInfo); 98 99 let securityPatchTagInfo: string = deviceinfo.securityPatchTag; 100 console.info('the value of the deviceinfo securityPatchTag is :' + securityPatchTagInfo); 101 102 let displayVersionInfo: string = deviceinfo.displayVersion; 103 console.info('the value of the deviceinfo displayVersion is :' + displayVersionInfo); 104 105 let incrementalVersionInfo: string = deviceinfo.incrementalVersion; 106 console.info('the value of the deviceinfo incrementalVersion is :' + incrementalVersionInfo); 107 108 let osReleaseTypeInfo: string = deviceinfo.osReleaseType; 109 console.info('the value of the deviceinfo osReleaseType is :' + osReleaseTypeInfo); 110 111 let osFullNameInfo: string = deviceinfo.osFullName; 112 console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo); 113 114 let majorVersionInfo: number = deviceinfo.majorVersion; 115 console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo); 116 117 let seniorVersionInfo: number = deviceinfo.seniorVersion; 118 console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo); 119 120 let featureVersionInfo: number = deviceinfo.featureVersion; 121 console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo); 122 123 let buildVersionInfo: number = deviceinfo.buildVersion; 124 console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo); 125 126 let sdkApiVersionInfo: number = deviceinfo.sdkApiVersion; 127 console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo); 128 129 let firstApiVersionInfo: number = deviceinfo.firstApiVersion; 130 console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo); 131 132 let versionIdInfo: string = deviceinfo.versionId; 133 console.info('the value of the deviceinfo versionId is :' + versionIdInfo); 134 135 let buildTypeInfo: string = deviceinfo.buildType; 136 console.info('the value of the deviceinfo buildType is :' + buildTypeInfo); 137 138 let buildUserInfo: string = deviceinfo.buildUser; 139 console.info('the value of the deviceinfo buildUser is :' + buildUserInfo); 140 141 let buildHostInfo: string = deviceinfo.buildHost; 142 console.info('the value of the deviceinfo buildHost is :' + buildHostInfo); 143 144 let buildTimeInfo: string = deviceinfo.buildTime; 145 console.info('the value of the deviceinfo buildTime is :' + buildTimeInfo); 146 147 let buildRootHashInfo: string = deviceinfo.buildRootHash; 148 console.info('the value of the deviceinfo buildRootHash is :' + buildRootHashInfo); 149 150 let udid: string = deviceinfo.udid; 151 console.info('the value of the deviceinfo udid is :' + udid); 152 153 let distributionOSName: string = deviceinfo.distributionOSName 154 console.info('the value of the deviceinfo distributionOSName is :' + distributionOSName); 155 156 let distributionOSVersion: string = deviceinfo.distributionOSVersion 157 console.info('the value of the deviceinfo distributionOSVersion is :' + distributionOSVersion); 158 159 let distributionOSApiVersion: number = deviceinfo.distributionOSApiVersion 160 console.info('the value of the deviceinfo distributionOSApiVersion is :' + distributionOSApiVersion); 161 162 let distributionOSReleaseType: string = deviceinfo.distributionOSReleaseType 163 console.info('the value of the deviceinfo distributionOSReleaseType is :' + distributionOSReleaseType); 164 165``` 166