1# @ohos.deviceInfo (Device Information) 2 3The **deviceInfo** module provides terminal device information query, which cannot be configured by developers. 4 5> **NOTE** 6> 7> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. 8> Some parameters whose return value is the default value are not yet available. 9> The APIs of this module return information about device constants. You're not expected to call these APIs frequently. 10 11## Modules to Import 12 13```ts 14import { deviceInfo } from '@kit.BasicServicesKit'; 15``` 16 17## Attributes 18> **NOTE** 19> Unless otherwise specified, the maximum data length is 96 bytes. 20 21**System capability**: SystemCapability.Startup.SystemInfo 22 23**Required permissions**: The items in the table below require different system capabilities. 24 25| Name| Type| Readable| Writable| Description| Example| 26| -------- | -------- | -------- | -------- | -------- | -------- | 27| deviceType | string | Yes| No| Device type. For details, see [deviceTypes tag](../../quick-start/module-configuration-file.md#devicetypes).<br>**Atomic service API**: This API can be used in atomic services since API version 11.| phone | 28| manufacture | string | Yes| No| Device manufacturer.| HUAWEI | 29| brand | string | Yes| No| Device brand.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| HUAWEI | 30| marketName | string | Yes| No| Marketing name.| Mate XX | 31| productSeries | string | Yes| No| Product series.| TAS | 32| productModel | string | Yes| No| Product model.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| TAS-AL00 | 33| softwareModel | string | Yes| No| Software model.| TAS-AL00 | 34| hardwareModel | string | Yes| No| Hardware model.| TASA00CVN1 | 35| hardwareProfile<sup>(deprecated) </sup> | string | Yes| No| Hardware profile.<br>**NOTE**<br>This API is supported since API version 6 and deprecated since API version 9.| NA | 36| serial | string | Yes| No| Device SN, available only for system applications.<br>**NOTE**<br>The device SN can be used as the unique identifier of a device.<br>**Required permissions**: ohos.permission.sec.ACCESS_UDID| The device SN varies according to devices.| 37| bootloaderVersion | string | Yes| No| Bootloader version.| bootloater | 38| abiList | string | Yes| No| Application binary interface (Abi) list.| arm64-v8a | 39| securityPatchTag | string | Yes| No| Security patch tag.| 2021-01-01 | 40| displayVersion | string | Yes| No| Product version.| XXX X.X.X.X | 41| incrementalVersion | string | Yes| No| Incremental version.| NA | 42| osReleaseType | string | Yes| No| OS release type. The options are as follows:<br>- **Canary**: Preliminary release open only to specific developers. This release does not promise API stability and may require tolerance of instability.<br>- **Beta**: Release open to all developers. This release does not promise API stability and may require tolerance of instability.<br>- **Release**: Official release open to all developers. This release promises that all APIs are stable.| Canary\\Beta\\Release | 43| osFullName | string | Yes| No| System version. The version number is in the format of **OpenHarmony-x.x.x.x**, where **x** is a digit.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| Openharmony-5.0.0.1 | 44| majorVersion | number | Yes| No| Major version number, which increments with the main version. The value is the first digit in **osFullName**. You are advised to use **deviceInfo.majorVersion** instead of parsing **osFullName** to obtain the value.| 5 | 45| seniorVersion | number | Yes| No| Senior version number, which increments with architecture and feature updates. The value is the second digit in **osFullName**. You are advised to use **deviceInfo.seniorVersion** instead of parsing **osFullName** to obtain the value.| 0 | 46| featureVersion | number | Yes| No| Feature version number. The value is the third digit in **osFullName**. You are advised to use **deviceInfo.featureVersion** instead of parsing **osFullName** to obtain the value.| 0 | 47| buildVersion | number | Yes| No| Build version number. The value is the fourth digit in **osFullName**. You are advised to use **deviceInfo.buildVersion** instead of parsing **osFullName** to obtain the value.| 1 | 48| sdkApiVersion | number | Yes| No| SDK API version.| 12 | 49| firstApiVersion | number | Yes| No| First API version.| 3 | 50| versionId | string | Yes| No| Version ID. It consists of the following fields: **deviceType**, **manufacture**, **brand**, **productSeries**, **osFullName**, **productModel**, **softwareModel**, **sdkApiVersion**, **incrementalVersion**, and **buildType**.| NA | 51| buildType | string | Yes| No| Build type.| release:nolog | 52| buildUser | string | Yes| No| Build user.| NA | 53| buildHost | string | Yes| No| Build host.| NA | 54| buildTime | string | Yes| No| Build time.| NA | 55| buildRootHash | string | Yes| No| Build root hash.| NA | 56| udid<sup>7+</sup> | string | Yes| No| Device UDID, available only for system applications.<br>**NOTE**<br>The data length is 65 bytes. The UDID can be used as the unique identifier of a device.<br>**Required permissions**: ohos.permission.sec.ACCESS_UDID| NA | 57| distributionOSName<sup>10+</sup> | String | Yes| No| Distribution OS name.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 58| distributionOSVersion<sup>10+</sup> | String | Yes| No| Distribution OS version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.<!--RP1--><!--RP1End--> | NA | 59| distributionOSApiVersion<sup>10+</sup> | number| Yes| No| Distribution OS API version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 60| distributionOSReleaseType<sup>10+</sup> | String | Yes| No| Distribution OS release type.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 61| ODID<sup>12+</sup> | String | Yes| No|Vendor Anonymous Identifier<br>An ODID will be regenerated in the following scenarios:<br>Restore a phone to its factory settings.<br>Uninstall and reinstall all apps of one developer on one device.<br>An ODID is generated based on the following rules:<br>For apps from the same developer, which are running on the same device, they have the same ODID.<br>For apps from different developers, which are running on the same device, each of them has its own ODID.<br>For apps from the same developer, which are running on different devices, each of them has its own ODID.<br>For apps from different developers, which are running on different devices, each of them has its own ODID.<br>**NOTE**<br>The data length is 37 bytes.| NA | 62 63**Example** 64 65```ts 66 import { deviceInfo } from '@kit.BasicServicesKit'; 67 68 let deviceTypeInfo: string = deviceInfo.deviceType; 69 console.info('the value of the deviceType is :' + deviceTypeInfo); 70 71 let manufactureInfo: string = deviceInfo.manufacture; 72 console.info('the value of the manufactureInfo is :' + manufactureInfo); 73 74 let brandInfo: string = deviceInfo.brand; 75 console.info('the value of the device brand is :' + brandInfo); 76 77 let marketNameInfo: string = deviceInfo.marketName; 78 console.info('the value of the deviceInfo marketName is :' + marketNameInfo); 79 80 let productSeriesInfo: string = deviceInfo.productSeries; 81 console.info('the value of the deviceInfo productSeries is :' + productSeriesInfo); 82 83 let productModelInfo: string = deviceInfo.productModel; 84 console.info('the value of the deviceInfo productModel is :' + productModelInfo); 85 86 let softwareModelInfo: string = deviceInfo.softwareModel; 87 console.info('the value of the deviceInfo softwareModel is :' + softwareModelInfo); 88 89 let hardwareModelInfo: string = deviceInfo.hardwareModel; 90 console.info('the value of the deviceInfo hardwareModel is :' + hardwareModelInfo); 91 92 let serialInfo: string = deviceInfo.serial; 93 console.info('the value of the deviceInfo serial is :' + serialInfo); 94 95 let bootloaderVersionInfo: string = deviceInfo.bootloaderVersion; 96 console.info('the value of the deviceInfo bootloaderVersion is :' + bootloaderVersionInfo); 97 98 let abiListInfo: string = deviceInfo.abiList; 99 console.info('the value of the deviceInfo abiList is :' + abiListInfo); 100 101 let securityPatchTagInfo: string = deviceInfo.securityPatchTag; 102 console.info('the value of the deviceInfo securityPatchTag is :' + securityPatchTagInfo); 103 104 let displayVersionInfo: string = deviceInfo.displayVersion; 105 console.info('the value of the deviceInfo displayVersion is :' + displayVersionInfo); 106 107 let incrementalVersionInfo: string = deviceInfo.incrementalVersion; 108 console.info('the value of the deviceInfo incrementalVersion is :' + incrementalVersionInfo); 109 110 let osReleaseTypeInfo: string = deviceInfo.osReleaseType; 111 console.info('the value of the deviceInfo osReleaseType is :' + osReleaseTypeInfo); 112 113 let osFullNameInfo: string = deviceInfo.osFullName; 114 console.info('the value of the deviceInfo osFullName is :' + osFullNameInfo); 115 116 let majorVersionInfo: number = deviceInfo.majorVersion; 117 console.info('the value of the deviceInfo majorVersion is :' + majorVersionInfo); 118 119 let seniorVersionInfo: number = deviceInfo.seniorVersion; 120 console.info('the value of the deviceInfo seniorVersion is :' + seniorVersionInfo); 121 122 let featureVersionInfo: number = deviceInfo.featureVersion; 123 console.info('the value of the deviceInfo featureVersion is :' + featureVersionInfo); 124 125 let buildVersionInfo: number = deviceInfo.buildVersion; 126 console.info('the value of the deviceInfo buildVersion is :' + buildVersionInfo); 127 128 let sdkApiVersionInfo: number = deviceInfo.sdkApiVersion; 129 console.info('the value of the deviceInfo sdkApiVersion is :' + sdkApiVersionInfo); 130 131 let firstApiVersionInfo: number = deviceInfo.firstApiVersion; 132 console.info('the value of the deviceInfo firstApiVersion is :' + firstApiVersionInfo); 133 134 let versionIdInfo: string = deviceInfo.versionId; 135 console.info('the value of the deviceInfo versionId is :' + versionIdInfo); 136 137 let buildTypeInfo: string = deviceInfo.buildType; 138 console.info('the value of the deviceInfo buildType is :' + buildTypeInfo); 139 140 let buildUserInfo: string = deviceInfo.buildUser; 141 console.info('the value of the deviceInfo buildUser is :' + buildUserInfo); 142 143 let buildHostInfo: string = deviceInfo.buildHost; 144 console.info('the value of the deviceInfo buildHost is :' + buildHostInfo); 145 146 let buildTimeInfo: string = deviceInfo.buildTime; 147 console.info('the value of the deviceInfo buildTime is :' + buildTimeInfo); 148 149 let buildRootHashInfo: string = deviceInfo.buildRootHash; 150 console.info('the value of the deviceInfo buildRootHash is :' + buildRootHashInfo); 151 152 let udid: string = deviceInfo.udid; 153 console.info('the value of the deviceInfo udid is :' + udid); 154 155 let distributionOSName: string = deviceInfo.distributionOSName 156 console.info('the value of the deviceInfo distributionOSName is :' + distributionOSName); 157 158 let distributionOSVersion: string = deviceInfo.distributionOSVersion 159 console.info('the value of the deviceInfo distributionOSVersion is :' + distributionOSVersion); 160 161 let distributionOSApiVersion: number = deviceInfo.distributionOSApiVersion 162 console.info('the value of the deviceInfo distributionOSApiVersion is :' + distributionOSApiVersion); 163 164 let distributionOSReleaseType: string = deviceInfo.distributionOSReleaseType 165 console.info('the value of the deviceInfo distributionOSReleaseType is :' + distributionOSReleaseType); 166 167 let odid: string = deviceInfo.ODID; 168 console.info('the value of the deviceInfo odid is :' + odid); 169 170``` 171