1# @system.device (Device Information) 2 3The **device** module provides APIs for checking information about the current device. 4 5> **NOTE** 6> 7> - The APIs of this module are no longer maintained since API version 6. It is recommended that you use [@ohos.deviceInfo](js-apis-device-info.md) instead. 8> 9> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. 10 11## Modules to Import 12 13``` 14import device from '@system.device'; 15``` 16 17## device.getInfo 18 19getInfo(options?: GetDeviceOptions): void 20 21Obtains the device information. 22 23> **NOTE** 24> 25> Do not call **device.getInfo** before the **onShow** event of the home page. 26 27**System capability**: SystemCapability.Startup.SystemInfo 28 29**Parameters** 30 31| Name| Type| Mandatory| Description| 32| -------- | -------- | -------- | -------- | 33| options | [GetDeviceOptions](#getdeviceoptions) | No| Parameters for obtaining the device information.| 34 35## GetDeviceOptions 36 37Defines the parameters for obtaining the device information. 38 39**System capability**: SystemCapability.Startup.SystemInfo 40 41| Name| Type| Mandatory| Description| 42| -------- | -------- | -------- | -------- | 43| success | (data: DeviceResponse)=> void| No| Called when API call is successful. **data** indicates the returned device information. For details, see [DeviceResponse](#deviceresponse).| 44| fail | (data: any,code:number)=> void| No| Called when API call has failed. **code** indicates the error code returned upon a failure.<br>**code:200**: Certain information could not be obtained.| 45| complete | () => void| No| Called when API call is complete.| 46 47## DeviceResponse 48 49Provides the device information. 50 51**System capability**: SystemCapability.Startup.SystemInfo 52 53| Name| Type| Description| 54| -------- | -------- | -------- | 55| brand | string | Brand.| 56| manufacturer | string | Manufacturer.| 57| model | string | Model.| 58| product | string | Product number.| 59| language<sup>4+</sup> | string | System language.| 60| region<sup>4+</sup> | string | System region.| 61| windowWidth | number | Window width.| 62| windowHeight | number | Window height.| 63| screenDensity<sup>4+</sup> | number | Screen density.| 64| screenShape<sup>4+</sup> | string | Screen shape. The options are as follows:<br>- **rect**: rectangular screen<br>- **circle**: round screen| 65| apiVersion<sup>4+</sup> | number | API version.| 66| releaseType<sup>4+</sup> | string | Release type. The value includes both the release type and the API version, for example, Beta1.<br>Available release types are as follows:<br>- **Canary**: Releases of this type are compatible with each other under the same API version, but not with those of the **beta** and **release** type.<br>- **Beta**: Releases of this type are compatible with each other under the same API version, but not with those of the **release** type.<br>- **Release**: Releases of this type are compatible with the latest five API versions. | 67| deviceType<sup>4+</sup> | string | Device type.| 68 69 70**Example** 71 72``` 73export default { 74 getInfo() { 75 device.getInfo({ 76 success: function(data) { 77 console.log('Device information obtained successfully. Device brand:' + data.brand); 78 }, 79 fail: function(data, code) { 80 console.log('Failed to obtain device information. Error code:'+ code + '; Error information: ' + data); 81 }, 82 }); 83 }, 84} 85``` 86