• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# @ohos.deviceInfo (Device Information)
2
3The **deviceInfo** module provides product information.
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
9## Modules to Import
10
11```ts
12import deviceInfo from '@ohos.deviceInfo'
13```
14
15## Attributes
16
17**System capability**: SystemCapability.Startup.SystemInfo
18
19| Name| Type| Readable| Writable| Description|
20| -------- | -------- | -------- | -------- | -------- |
21| deviceType | string | Yes| No| Device type.|
22| manufacture | string | Yes| No| Device manufacturer.|
23| brand | string | Yes| No| Device brand.|
24| marketName | string | Yes| No| Marketing name.|
25| productSeries | string | Yes| No| Product series.|
26| productModel | string | Yes| No| Product model.|
27| softwareModel | string | Yes| No| Software model.|
28| hardwareModel | string | Yes| No| Hardware model.|
29| hardwareProfile | string | Yes| No| Hardware profile.|
30| serial | string | Yes| No| Device serial number.<br>**Required permissions**: ohos.permission.sec.ACCESS_UDID|
31| bootloaderVersion | string | Yes| No| Bootloader version.|
32| abiList | string | Yes| No| Application binary interface (Abi) list.|
33| securityPatchTag | string | Yes| No| Security patch tag.|
34| displayVersion | string | Yes| No| Product version.|
35| incrementalVersion | string | Yes| No| Incremental version.|
36| 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.|
37| osFullName | string | Yes| No| OS version.|
38| majorVersion | number | Yes| No| Major version, incrementing along with OS version updates.|
39| seniorVersion | number | Yes| No| Senior version, incrementing along with architecture and feature updates.|
40| featureVersion | number | Yes| No| Feature version.|
41| buildVersion | number | Yes| No| Build version.|
42| sdkApiVersion | number | Yes| No| SDK API version.|
43| firstApiVersion | number | Yes| No| First API version.|
44| versionId | string | Yes| No| Version ID.|
45| buildType | string | Yes| No| Build type.|
46| buildUser | string | Yes| No| Build user.|
47| buildHost | string | Yes| No| Build host.|
48| buildTime | string | Yes| No| Build time.|
49| buildRootHash | string | Yes| No| Build root hash.|
50| udid<sup>7+</sup> | string | Yes| No| Device UDID.<br>**Required permissions**: ohos.permission.sec.ACCESS_UDID|
51| distributionOSName<sup>10+</sup> | String | Yes| No| Name of the distribution OS.|
52| distributionOSVersion<sup>10+</sup> | String | Yes| No| Version number of the distribution OS.|
53| distributionOSApiVersion<sup>10+</sup> | number| Yes| No| API version of the distribution OS.|
54| distributionOSReleaseType<sup>10+</sup> | String | Yes| No| Type of the distribution OS.|
55
56**Example**
57
58```
59    import deviceinfo from '@ohos.deviceInfo'
60
61    let deviceTypeInfo = deviceinfo.deviceType;
62    console.info('the value of the deviceType is :' + deviceTypeInfo);
63
64    let manufactureInfo = deviceinfo.manufacture;
65    console.info('the value of the manufactureInfo is :' + manufactureInfo);
66
67    let brandInfo = deviceinfo.brand;
68    console.info('the value of the device brand is :' + brandInfo);
69
70    let marketNameInfo = deviceinfo.marketName;
71    console.info('the value of the deviceinfo marketName is :' + marketNameInfo);
72
73    let productSeriesInfo = deviceinfo.productSeries;
74    console.info('the value of the deviceinfo productSeries is :' + productSeriesInfo);
75
76    let productModelInfo = deviceinfo.productModel;
77    console.info('the value of the deviceinfo productModel is :' + productModelInfo);
78
79    let softwareModelInfo = deviceinfo.softwareModel;
80    console.info('the value of the deviceinfo softwareModel is :' + softwareModelInfo);
81
82    let hardwareModelInfo = deviceinfo.hardwareModel;
83    console.info('the value of the deviceinfo hardwareModel is :' + hardwareModelInfo);
84
85    let hardwareProfileInfo = deviceinfo.hardwareProfile;
86    console.info('the value of the deviceinfo hardwareProfile is :' + hardwareProfileInfo);
87
88    let serialInfo = deviceinfo.serial;
89    console.info('the value of the deviceinfo serial is :' + serialInfo);
90
91    let bootloaderVersionInfo = deviceinfo.bootloaderVersion;
92    console.info('the value of the deviceinfo bootloaderVersion is :' + bootloaderVersionInfo);
93
94    let abiListInfo = deviceinfo.abiList;
95    console.info('the value of the deviceinfo abiList is :' + abiListInfo);
96
97    let securityPatchTagInfo = deviceinfo.securityPatchTag;
98    console.info('the value of the deviceinfo securityPatchTag is :' + securityPatchTagInfo);
99
100    let displayVersionInfo = deviceinfo.displayVersion;
101    console.info('the value of the deviceinfo displayVersion is :' + displayVersionInfo);
102
103    let incrementalVersionInfo = deviceinfo.incrementalVersion;
104    console.info('the value of the deviceinfo incrementalVersion is :' + incrementalVersionInfo);
105
106    let osReleaseTypeInfo = deviceinfo.osReleaseType;
107    console.info('the value of the deviceinfo osReleaseType is :' + osReleaseTypeInfo);
108
109    let osFullNameInfo = deviceinfo.osFullName;
110    console.info('the value of the deviceinfo osFullName is :' + osFullNameInfo);
111
112    let majorVersionInfo = deviceinfo.majorVersion;
113    console.info('the value of the deviceinfo majorVersion is :' + majorVersionInfo);
114
115    let seniorVersionInfo = deviceinfo.seniorVersion;
116    console.info('the value of the deviceinfo seniorVersion is :' + seniorVersionInfo);
117
118    let featureVersionInfo = deviceinfo.featureVersion;
119    console.info('the value of the deviceinfo featureVersion is :' + featureVersionInfo);
120
121    let buildVersionInfo = deviceinfo.buildVersion;
122    console.info('the value of the deviceinfo buildVersion is :' + buildVersionInfo);
123
124    let sdkApiVersionInfo = deviceinfo.sdkApiVersion;
125    console.info('the value of the deviceinfo sdkApiVersion is :' + sdkApiVersionInfo);
126
127    let firstApiVersionInfo = deviceinfo.firstApiVersion;
128    console.info('the value of the deviceinfo firstApiVersion is :' + firstApiVersionInfo);
129
130    let versionIdInfo = deviceinfo.versionId;
131    console.info('the value of the deviceinfo versionId is :' + versionIdInfo);
132
133    let buildTypeInfo = deviceinfo.buildType;
134    console.info('the value of the deviceinfo buildType is :' + buildTypeInfo);
135
136    let buildUserInfo = deviceinfo.buildUser;
137    console.info('the value of the deviceinfo buildUser is :' + buildUserInfo);
138
139    let buildHostInfo = deviceinfo.buildHost;
140    console.info('the value of the deviceinfo buildHost is :' + buildHostInfo);
141
142    let buildTimeInfo = deviceinfo.buildTime;
143    console.info('the value of the deviceinfo buildTime is :' + buildTimeInfo);
144
145    let buildRootHashInfo = deviceinfo.buildRootHash;
146    console.info('the value of the deviceinfo buildRootHash is :' + buildRootHashInfo);
147
148    let udid = deviceinfo.udid;
149    console.info('the value of the deviceinfo udid is :' + udid);
150
151    let distributionOSName = deviceinfo.distributionOSName
152    console.info('the value of the deviceinfo distributionOSName is :' + distributionOSName);
153
154    let distributionOSVersion = deviceinfo.distributionOSVersion
155    console.info('the value of the deviceinfo distributionOSVersion is :' + distributionOSVersion);
156
157    let distributionOSApiVersion = deviceinfo.distributionOSApiVersion
158    console.info('the value of the deviceinfo distributionOSApiVersion is :' + distributionOSApiVersion);
159
160    let distributionOSReleaseType = deviceinfo.distributionOSReleaseType
161    console.info('the value of the deviceinfo distributionOSReleaseType is :' + distributionOSReleaseType);
162
163```
164