1e41f4b71Sopenharmony_ci# @ohos.deviceInfo (Device Information) 2e41f4b71Sopenharmony_ci 3e41f4b71Sopenharmony_ciThe **deviceInfo** module provides terminal device information query, which cannot be configured by developers. 4e41f4b71Sopenharmony_ci 5e41f4b71Sopenharmony_ci> **NOTE** 6e41f4b71Sopenharmony_ci> 7e41f4b71Sopenharmony_ci> 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. 8e41f4b71Sopenharmony_ci> Some parameters whose return value is the default value are not yet available. 9e41f4b71Sopenharmony_ci> The APIs of this module return information about device constants. You're not expected to call these APIs frequently. 10e41f4b71Sopenharmony_ci 11e41f4b71Sopenharmony_ci## Modules to Import 12e41f4b71Sopenharmony_ci 13e41f4b71Sopenharmony_ci```ts 14e41f4b71Sopenharmony_ciimport { deviceInfo } from '@kit.BasicServicesKit'; 15e41f4b71Sopenharmony_ci``` 16e41f4b71Sopenharmony_ci 17e41f4b71Sopenharmony_ci## Attributes 18e41f4b71Sopenharmony_ci> **NOTE** 19e41f4b71Sopenharmony_ci> Unless otherwise specified, the maximum data length is 96 bytes. 20e41f4b71Sopenharmony_ci 21e41f4b71Sopenharmony_ci**System capability**: SystemCapability.Startup.SystemInfo 22e41f4b71Sopenharmony_ci 23e41f4b71Sopenharmony_ci**Required permissions**: The items in the table below require different system capabilities. 24e41f4b71Sopenharmony_ci 25e41f4b71Sopenharmony_ci| Name| Type| Readable| Writable| Description| Example| 26e41f4b71Sopenharmony_ci| -------- | -------- | -------- | -------- | -------- | -------- | 27e41f4b71Sopenharmony_ci| 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 | 28e41f4b71Sopenharmony_ci| manufacture | string | Yes| No| Device manufacturer.| HUAWEI | 29e41f4b71Sopenharmony_ci| brand | string | Yes| No| Device brand.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| HUAWEI | 30e41f4b71Sopenharmony_ci| marketName | string | Yes| No| Marketing name.| Mate XX | 31e41f4b71Sopenharmony_ci| productSeries | string | Yes| No| Product series.| TAS | 32e41f4b71Sopenharmony_ci| productModel | string | Yes| No| Product model.<br>**Atomic service API**: This API can be used in atomic services since API version 11.| TAS-AL00 | 33e41f4b71Sopenharmony_ci| softwareModel | string | Yes| No| Software model.| TAS-AL00 | 34e41f4b71Sopenharmony_ci| hardwareModel | string | Yes| No| Hardware model.| TASA00CVN1 | 35e41f4b71Sopenharmony_ci| 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 | 36e41f4b71Sopenharmony_ci| 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.| 37e41f4b71Sopenharmony_ci| bootloaderVersion | string | Yes| No| Bootloader version.| bootloater | 38e41f4b71Sopenharmony_ci| abiList | string | Yes| No| Application binary interface (Abi) list.| arm64-v8a | 39e41f4b71Sopenharmony_ci| securityPatchTag | string | Yes| No| Security patch tag.| 2021-01-01 | 40e41f4b71Sopenharmony_ci| displayVersion | string | Yes| No| Product version.| XXX X.X.X.X | 41e41f4b71Sopenharmony_ci| incrementalVersion | string | Yes| No| Incremental version.| NA | 42e41f4b71Sopenharmony_ci| 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 | 43e41f4b71Sopenharmony_ci| 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 | 44e41f4b71Sopenharmony_ci| 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 | 45e41f4b71Sopenharmony_ci| 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 | 46e41f4b71Sopenharmony_ci| 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 | 47e41f4b71Sopenharmony_ci| 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 | 48e41f4b71Sopenharmony_ci| sdkApiVersion | number | Yes| No| SDK API version.| 12 | 49e41f4b71Sopenharmony_ci| firstApiVersion | number | Yes| No| First API version.| 3 | 50e41f4b71Sopenharmony_ci| versionId | string | Yes| No| Version ID. It consists of the following fields: **deviceType**, **manufacture**, **brand**, **productSeries**, **osFullName**, **productModel**, **softwareModel**, **sdkApiVersion**, **incrementalVersion**, and **buildType**.| NA | 51e41f4b71Sopenharmony_ci| buildType | string | Yes| No| Build type.| release:nolog | 52e41f4b71Sopenharmony_ci| buildUser | string | Yes| No| Build user.| NA | 53e41f4b71Sopenharmony_ci| buildHost | string | Yes| No| Build host.| NA | 54e41f4b71Sopenharmony_ci| buildTime | string | Yes| No| Build time.| NA | 55e41f4b71Sopenharmony_ci| buildRootHash | string | Yes| No| Build root hash.| NA | 56e41f4b71Sopenharmony_ci| 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 | 57e41f4b71Sopenharmony_ci| distributionOSName<sup>10+</sup> | String | Yes| No| Distribution OS name.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 58e41f4b71Sopenharmony_ci| distributionOSVersion<sup>10+</sup> | String | Yes| No| Distribution OS version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.<!--RP1--><!--RP1End--> | NA | 59e41f4b71Sopenharmony_ci| distributionOSApiVersion<sup>10+</sup> | number| Yes| No| Distribution OS API version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 60e41f4b71Sopenharmony_ci| distributionOSReleaseType<sup>10+</sup> | String | Yes| No| Distribution OS release type.<!--Del--> It is defined by the issuer.<!--DelEnd-->.| NA | 61e41f4b71Sopenharmony_ci| 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 | 62e41f4b71Sopenharmony_ci 63e41f4b71Sopenharmony_ci**Example** 64e41f4b71Sopenharmony_ci 65e41f4b71Sopenharmony_ci```ts 66e41f4b71Sopenharmony_ci import { deviceInfo } from '@kit.BasicServicesKit'; 67e41f4b71Sopenharmony_ci 68e41f4b71Sopenharmony_ci let deviceTypeInfo: string = deviceInfo.deviceType; 69e41f4b71Sopenharmony_ci console.info('the value of the deviceType is :' + deviceTypeInfo); 70e41f4b71Sopenharmony_ci 71e41f4b71Sopenharmony_ci let manufactureInfo: string = deviceInfo.manufacture; 72e41f4b71Sopenharmony_ci console.info('the value of the manufactureInfo is :' + manufactureInfo); 73e41f4b71Sopenharmony_ci 74e41f4b71Sopenharmony_ci let brandInfo: string = deviceInfo.brand; 75e41f4b71Sopenharmony_ci console.info('the value of the device brand is :' + brandInfo); 76e41f4b71Sopenharmony_ci 77e41f4b71Sopenharmony_ci let marketNameInfo: string = deviceInfo.marketName; 78e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo marketName is :' + marketNameInfo); 79e41f4b71Sopenharmony_ci 80e41f4b71Sopenharmony_ci let productSeriesInfo: string = deviceInfo.productSeries; 81e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo productSeries is :' + productSeriesInfo); 82e41f4b71Sopenharmony_ci 83e41f4b71Sopenharmony_ci let productModelInfo: string = deviceInfo.productModel; 84e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo productModel is :' + productModelInfo); 85e41f4b71Sopenharmony_ci 86e41f4b71Sopenharmony_ci let softwareModelInfo: string = deviceInfo.softwareModel; 87e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo softwareModel is :' + softwareModelInfo); 88e41f4b71Sopenharmony_ci 89e41f4b71Sopenharmony_ci let hardwareModelInfo: string = deviceInfo.hardwareModel; 90e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo hardwareModel is :' + hardwareModelInfo); 91e41f4b71Sopenharmony_ci 92e41f4b71Sopenharmony_ci let serialInfo: string = deviceInfo.serial; 93e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo serial is :' + serialInfo); 94e41f4b71Sopenharmony_ci 95e41f4b71Sopenharmony_ci let bootloaderVersionInfo: string = deviceInfo.bootloaderVersion; 96e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo bootloaderVersion is :' + bootloaderVersionInfo); 97e41f4b71Sopenharmony_ci 98e41f4b71Sopenharmony_ci let abiListInfo: string = deviceInfo.abiList; 99e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo abiList is :' + abiListInfo); 100e41f4b71Sopenharmony_ci 101e41f4b71Sopenharmony_ci let securityPatchTagInfo: string = deviceInfo.securityPatchTag; 102e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo securityPatchTag is :' + securityPatchTagInfo); 103e41f4b71Sopenharmony_ci 104e41f4b71Sopenharmony_ci let displayVersionInfo: string = deviceInfo.displayVersion; 105e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo displayVersion is :' + displayVersionInfo); 106e41f4b71Sopenharmony_ci 107e41f4b71Sopenharmony_ci let incrementalVersionInfo: string = deviceInfo.incrementalVersion; 108e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo incrementalVersion is :' + incrementalVersionInfo); 109e41f4b71Sopenharmony_ci 110e41f4b71Sopenharmony_ci let osReleaseTypeInfo: string = deviceInfo.osReleaseType; 111e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo osReleaseType is :' + osReleaseTypeInfo); 112e41f4b71Sopenharmony_ci 113e41f4b71Sopenharmony_ci let osFullNameInfo: string = deviceInfo.osFullName; 114e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo osFullName is :' + osFullNameInfo); 115e41f4b71Sopenharmony_ci 116e41f4b71Sopenharmony_ci let majorVersionInfo: number = deviceInfo.majorVersion; 117e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo majorVersion is :' + majorVersionInfo); 118e41f4b71Sopenharmony_ci 119e41f4b71Sopenharmony_ci let seniorVersionInfo: number = deviceInfo.seniorVersion; 120e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo seniorVersion is :' + seniorVersionInfo); 121e41f4b71Sopenharmony_ci 122e41f4b71Sopenharmony_ci let featureVersionInfo: number = deviceInfo.featureVersion; 123e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo featureVersion is :' + featureVersionInfo); 124e41f4b71Sopenharmony_ci 125e41f4b71Sopenharmony_ci let buildVersionInfo: number = deviceInfo.buildVersion; 126e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildVersion is :' + buildVersionInfo); 127e41f4b71Sopenharmony_ci 128e41f4b71Sopenharmony_ci let sdkApiVersionInfo: number = deviceInfo.sdkApiVersion; 129e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo sdkApiVersion is :' + sdkApiVersionInfo); 130e41f4b71Sopenharmony_ci 131e41f4b71Sopenharmony_ci let firstApiVersionInfo: number = deviceInfo.firstApiVersion; 132e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo firstApiVersion is :' + firstApiVersionInfo); 133e41f4b71Sopenharmony_ci 134e41f4b71Sopenharmony_ci let versionIdInfo: string = deviceInfo.versionId; 135e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo versionId is :' + versionIdInfo); 136e41f4b71Sopenharmony_ci 137e41f4b71Sopenharmony_ci let buildTypeInfo: string = deviceInfo.buildType; 138e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildType is :' + buildTypeInfo); 139e41f4b71Sopenharmony_ci 140e41f4b71Sopenharmony_ci let buildUserInfo: string = deviceInfo.buildUser; 141e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildUser is :' + buildUserInfo); 142e41f4b71Sopenharmony_ci 143e41f4b71Sopenharmony_ci let buildHostInfo: string = deviceInfo.buildHost; 144e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildHost is :' + buildHostInfo); 145e41f4b71Sopenharmony_ci 146e41f4b71Sopenharmony_ci let buildTimeInfo: string = deviceInfo.buildTime; 147e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildTime is :' + buildTimeInfo); 148e41f4b71Sopenharmony_ci 149e41f4b71Sopenharmony_ci let buildRootHashInfo: string = deviceInfo.buildRootHash; 150e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo buildRootHash is :' + buildRootHashInfo); 151e41f4b71Sopenharmony_ci 152e41f4b71Sopenharmony_ci let udid: string = deviceInfo.udid; 153e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo udid is :' + udid); 154e41f4b71Sopenharmony_ci 155e41f4b71Sopenharmony_ci let distributionOSName: string = deviceInfo.distributionOSName 156e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo distributionOSName is :' + distributionOSName); 157e41f4b71Sopenharmony_ci 158e41f4b71Sopenharmony_ci let distributionOSVersion: string = deviceInfo.distributionOSVersion 159e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo distributionOSVersion is :' + distributionOSVersion); 160e41f4b71Sopenharmony_ci 161e41f4b71Sopenharmony_ci let distributionOSApiVersion: number = deviceInfo.distributionOSApiVersion 162e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo distributionOSApiVersion is :' + distributionOSApiVersion); 163e41f4b71Sopenharmony_ci 164e41f4b71Sopenharmony_ci let distributionOSReleaseType: string = deviceInfo.distributionOSReleaseType 165e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo distributionOSReleaseType is :' + distributionOSReleaseType); 166e41f4b71Sopenharmony_ci 167e41f4b71Sopenharmony_ci let odid: string = deviceInfo.ODID; 168e41f4b71Sopenharmony_ci console.info('the value of the deviceInfo odid is :' + odid); 169e41f4b71Sopenharmony_ci 170e41f4b71Sopenharmony_ci``` 171