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 are 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|
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.<br>Example: wearable|
28| manufacture | string | Yes| No| Device manufacturer.<br>Example: HUAWEI|
29| brand | string | Yes| No| Device brand.<br>**Atomic service API**: This API can be used in atomic services since API version 11.<br>Example: HUAWEI|
30| marketName | string | Yes| No| Marketing name.<br>Example: Mate XX|
31| productSeries | string | Yes| No| Product series.<br>Example: TAS|
32| productModel | string | Yes| No| Product model.<br>**Atomic service API**: This API can be used in atomic services since API version 11.<br>Example: TAS-AL00|
33| productModelAlias<sup>14+</sup> | string | Yes| No| Product model alias.<br>**Atomic service API**: This API can be used in atomic services since API version 14.<br>Example: TAS-AL00|
34| softwareModel | string | Yes| No| Software model.<br>Example: TAS-AL00|
35| hardwareModel | string | Yes| No| Hardware model.<br>Example: TASA00CVN1|
36| 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.|
37| 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<br>Example: The SN varies with the device.|
38| bootloaderVersion | string | Yes| No| Bootloader version.<br>Example: bootloater|
39| abiList | string | Yes| No| Application binary interface (Abi) list.<br>Example: arm64-v8a|
40| securityPatchTag | string | Yes| No| Security patch tag.<br>Example: 2021-01-01|
41| displayVersion | string | Yes| No| Product version.<br>Example: XXX X.X.X.X|
42| incrementalVersion | string | Yes| No| Incremental version.|
43| 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.<br>Example: Canary\\Beta\\Release|
44| 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.<br>Example: Openharmony-5.0.0.1|
45| 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.<br>Example: 5|
46| 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.<br>Example: 0|
47| 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.<br>Example: 0|
48| 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.<br>Example: 1|
49| sdkApiVersion | number | Yes| No| SDK API version.<br>Example: 12|
50| firstApiVersion | number | Yes| No| First API version.<br>Example: 3|
51| versionId | string | Yes| No| Version ID. It consists of the following fields: **deviceType**, **manufacture**, **brand**, **productSeries**, **osFullName**, **productModel**, **softwareModel**, **sdkApiVersion**, **incrementalVersion**, and **buildType**.|
52| buildType | string | Yes| No| Build type.<br>Example: release:nolog|
53| buildUser | string | Yes| No| Build user.|
54| buildHost | string | Yes| No| Build host.|
55| buildTime | string | Yes| No| Build time.|
56| buildRootHash | string | Yes| No| Build root hash.|
57| 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 |
58| distributionOSName<sup>10+</sup> | String | Yes| No| Distribution OS name.<!--Del--> It is defined by the issuer.<!--DelEnd-->.|
59| distributionOSVersion<sup>10+</sup> | String | Yes| No| Distribution OS version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.<!--RP1--><!--RP1End-->  |
60| distributionOSApiVersion<sup>10+</sup> | number| Yes| No| Distribution OS API version.<!--Del--> It is defined by the issuer.<!--DelEnd-->.|
61| distributionOSApiName<sup>13+</sup> | String | Yes| No| Distribution OS API name.<!--Del--> It is defined by the issuer.<!--DelEnd-->.|
62| distributionOSReleaseType<sup>10+</sup> | String | Yes| No| Distribution OS release type.<!--Del--> It is defined by the issuer.<!--DelEnd-->.|
63| 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 applications with the same **developerId** on one device.<br>An ODID is generated based on the following rules:<br>The value is generated based on the **groupId** parsed from the **developerId** in the signature information. As **groupId.developerId** is the rule, if no **groupId** exists, the **developerId** is used as the **groupId**.<br>Applications with the same **developerId** use the same ODID on one device.<br>Applications with different **developerId**s use different ODIDs on one device.<br>Applications with the same **developerId** use different ODIDs on different devices.<br>Applications with different **developerId**s use different ODIDs on different devices.<br>**NOTE**<br>The data length is 37 bytes.|
64
65**Example**
66
67```ts
68    import { deviceInfo } from '@kit.BasicServicesKit';
69
70    let deviceTypeInfo: string = deviceInfo.deviceType;
71    console.info('the value of the deviceType is :' + deviceTypeInfo);
72
73    let manufactureInfo: string = deviceInfo.manufacture;
74    console.info('the value of the manufactureInfo is :' + manufactureInfo);
75
76    let brandInfo: string = deviceInfo.brand;
77    console.info('the value of the device brand is :' + brandInfo);
78
79    let marketNameInfo: string = deviceInfo.marketName;
80    console.info('the value of the deviceInfo marketName is :' + marketNameInfo);
81
82    let productSeriesInfo: string = deviceInfo.productSeries;
83    console.info('the value of the deviceInfo productSeries is :' + productSeriesInfo);
84
85    let productModelInfo: string = deviceInfo.productModel;
86    console.info('the value of the deviceInfo productModel is :' + productModelInfo);
87
88    let productModelAliasInfo: string = deviceInfo.productModelAlias;
89    console.info('the value of the deviceInfo productModelAlias is :' + productModelAliasInfo);
90
91    let softwareModelInfo: string = deviceInfo.softwareModel;
92    console.info('the value of the deviceInfo softwareModel is :' + softwareModelInfo);
93
94    let hardwareModelInfo: string = deviceInfo.hardwareModel;
95    console.info('the value of the deviceInfo hardwareModel is :' + hardwareModelInfo);
96
97    let serialInfo: string = deviceInfo.serial;
98    console.info('the value of the deviceInfo serial is :' + serialInfo);
99
100    let bootloaderVersionInfo: string = deviceInfo.bootloaderVersion;
101    console.info('the value of the deviceInfo bootloaderVersion is :' + bootloaderVersionInfo);
102
103    let abiListInfo: string = deviceInfo.abiList;
104    console.info('the value of the deviceInfo abiList is :' + abiListInfo);
105
106    let securityPatchTagInfo: string = deviceInfo.securityPatchTag;
107    console.info('the value of the deviceInfo securityPatchTag is :' + securityPatchTagInfo);
108
109    let displayVersionInfo: string = deviceInfo.displayVersion;
110    console.info('the value of the deviceInfo displayVersion is :' + displayVersionInfo);
111
112    let incrementalVersionInfo: string = deviceInfo.incrementalVersion;
113    console.info('the value of the deviceInfo incrementalVersion is :' + incrementalVersionInfo);
114
115    let osReleaseTypeInfo: string = deviceInfo.osReleaseType;
116    console.info('the value of the deviceInfo osReleaseType is :' + osReleaseTypeInfo);
117
118    let osFullNameInfo: string = deviceInfo.osFullName;
119    console.info('the value of the deviceInfo osFullName is :' + osFullNameInfo);
120
121    let majorVersionInfo: number = deviceInfo.majorVersion;
122    console.info('the value of the deviceInfo majorVersion is :' + majorVersionInfo);
123
124    let seniorVersionInfo: number = deviceInfo.seniorVersion;
125    console.info('the value of the deviceInfo seniorVersion is :' + seniorVersionInfo);
126
127    let featureVersionInfo: number = deviceInfo.featureVersion;
128    console.info('the value of the deviceInfo featureVersion is :' + featureVersionInfo);
129
130    let buildVersionInfo: number = deviceInfo.buildVersion;
131    console.info('the value of the deviceInfo buildVersion is :' + buildVersionInfo);
132
133    let sdkApiVersionInfo: number = deviceInfo.sdkApiVersion;
134    console.info('the value of the deviceInfo sdkApiVersion is :' + sdkApiVersionInfo);
135
136    let firstApiVersionInfo: number = deviceInfo.firstApiVersion;
137    console.info('the value of the deviceInfo firstApiVersion is :' + firstApiVersionInfo);
138
139    let versionIdInfo: string = deviceInfo.versionId;
140    console.info('the value of the deviceInfo versionId is :' + versionIdInfo);
141
142    let buildTypeInfo: string = deviceInfo.buildType;
143    console.info('the value of the deviceInfo buildType is :' + buildTypeInfo);
144
145    let buildUserInfo: string = deviceInfo.buildUser;
146    console.info('the value of the deviceInfo buildUser is :' + buildUserInfo);
147
148    let buildHostInfo: string = deviceInfo.buildHost;
149    console.info('the value of the deviceInfo buildHost is :' + buildHostInfo);
150
151    let buildTimeInfo: string = deviceInfo.buildTime;
152    console.info('the value of the deviceInfo buildTime is :' + buildTimeInfo);
153
154    let buildRootHashInfo: string = deviceInfo.buildRootHash;
155    console.info('the value of the deviceInfo buildRootHash is :' + buildRootHashInfo);
156
157    let udid: string = deviceInfo.udid;
158    console.info('the value of the deviceInfo udid is :' + udid);
159
160    let distributionOSName: string = deviceInfo.distributionOSName
161    console.info('the value of the deviceInfo distributionOSName is :' + distributionOSName);
162
163    let distributionOSVersion: string = deviceInfo.distributionOSVersion
164    console.info('the value of the deviceInfo distributionOSVersion is :' + distributionOSVersion);
165
166    let distributionOSApiVersion: number = deviceInfo.distributionOSApiVersion
167    console.info('the value of the deviceInfo distributionOSApiVersion is :' + distributionOSApiVersion);
168
169    let distributionOSApiName: number = deviceInfo.distributionOSApiName
170    console.info('the value of the deviceInfo distributionOSApiName is :' + distributionOSApiName);
171
172    let distributionOSReleaseType: string = deviceInfo.distributionOSReleaseType
173    console.info('the value of the deviceInfo distributionOSReleaseType is :' + distributionOSReleaseType);
174
175    let odid: string = deviceInfo.ODID;
176    console.info('the value of the deviceInfo odid is :' + odid);
177
178```
179