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