未验证 提交 b8aeec56 编写于 作者: O openharmony_ci 提交者: Gitee

!12723 翻译完成 10440

Merge pull request !12723 from ester.zhou/TR-10440
# Device Information
# @system.device
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> - 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.
The **device** module provides APIs for checking information about the current device.
> **NOTE**
> - 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.
>
> - 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.
## Modules to Import
```
import device from '@system.device';
```
## device.getInfo
getInfo(Object): void
Obtains the device information.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:**
> **NOTE**
>
> Do not call **device.getInfo** before the **onShow** event of the home page.
**System capability**: SystemCapability.Startup.SysInfo
**System capability**: SystemCapability.Startup.SystemInfo
**Parameters**
| Name | Type | Mandatory | Description |
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| success | Function | No | Called when the device information is obtained |
| fail | Function | No | Called when the device information fails to be obtained |
| complete | Function | No | Called when the execution is complete |
| success | Function | No| Called when API call is successful.|
| fail | Function | No| Called when API call has failed.|
| complete | Function | No| Called when API call is complete.|
The following values will be returned when the device information is obtained.
**Return value of success()**
| Name | Type | Description |
| Name| Type| Description|
| -------- | -------- | -------- |
| brand | string | Brand |
| manufacturer | string | Manufacturer |
| model | string | Model |
| product | string | Product number |
| language<sup>4+</sup> | string | System&nbsp;language |
| region<sup>4+</sup> | string | System&nbsp;region |
| windowWidth | number | Window&nbsp;width |
| windowHeight | number | Window&nbsp;height |
| screenDensity<sup>4+</sup> | number | Screen&nbsp;density |
| screenShape<sup>4+</sup> | string | Screen&nbsp;shape.&nbsp;The&nbsp;options&nbsp;are&nbsp;as&nbsp;follows:<br/>-&nbsp;rect:&nbsp;rectangle&nbsp;screen<br/>-&nbsp;circle:&nbsp;circle&nbsp;screen |
| apiVersion<sup>4+</sup> | number | API&nbsp;version |
| releaseType<sup>4+</sup> | string | Release&nbsp;type.&nbsp;The&nbsp;value&nbsp;includes&nbsp;both&nbsp;the&nbsp;release&nbsp;type&nbsp;and&nbsp;the&nbsp;API&nbsp;version,&nbsp;for&nbsp;example,&nbsp;Beta1.<br/>Available&nbsp;release&nbsp;types&nbsp;are&nbsp;as&nbsp;follows:<br/>-&nbsp;**Canary**:&nbsp;For&nbsp;the&nbsp;same&nbsp;API&nbsp;version,&nbsp;different&nbsp;canary&nbsp;releases&nbsp;are&nbsp;compatible&nbsp;with&nbsp;each&nbsp;other,&nbsp;but&nbsp;not&nbsp;compatible&nbsp;with&nbsp;those&nbsp;of&nbsp;the&nbsp;**beta**&nbsp;and&nbsp;**release**&nbsp;type.<br/>-&nbsp;**Beta**:&nbsp;For&nbsp;the&nbsp;same&nbsp;API&nbsp;version,&nbsp;different&nbsp;beta&nbsp;releases&nbsp;are&nbsp;compatible&nbsp;with&nbsp;each&nbsp;other,&nbsp;but&nbsp;not&nbsp;compatible&nbsp;with&nbsp;those&nbsp;of&nbsp;the&nbsp;**release**&nbsp;type.<br/>-&nbsp;**Release**:&nbsp;Releases&nbsp;of&nbsp;this&nbsp;type&nbsp;are&nbsp;compatible&nbsp;with&nbsp;the&nbsp;latest&nbsp;five&nbsp;API&nbsp;versions. |
| deviceType<sup>4+</sup> | string | Device type |
The following error code will be returned if the device information fails to be obtained.
| Error&nbsp;Code | Description |
| brand | string | Brand.|
| manufacturer | string | Manufacturer.|
| model | string | Model. |
| product | string | Product number.|
| language<sup>4+</sup> | string | System language.|
| region<sup>4+</sup> | string | System region.|
| windowWidth | number | Window width.|
| windowHeight | number | Window height.|
| screenDensity<sup>4+</sup> | number | Screen density.|
| screenShape<sup>4+</sup> | string | Screen shape. The options are as follows:<br>- **rect**: rectangle screen<br>- **circle**: circle screen|
| apiVersion<sup>4+</sup> | number | API version.|
| 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**: For the same API version, different canary releases are compatible with each other, but not compatible with those of the **beta** and **release** type.<br>- **Beta**: For the same API version, different beta releases are compatible with each other, but not compatible with those of the **release** type.<br>- **Release**: Releases of this type are compatible with the latest five API versions.|
| deviceType<sup>4+</sup> | string | Device type.|
**Return value of fail()**
| Error Code| Description|
| -------- | -------- |
| 200 | The&nbsp;returned&nbsp;result&nbsp;contains&nbsp;information&nbsp;that&nbsp;cannot&nbsp;be&nbsp;obtained. |
| 200 | The returned result contains information that cannot be obtained.|
**Example**
......@@ -72,4 +72,4 @@ export default {
});
},
}
```
\ No newline at end of file
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册