提交 a6c1e232 编写于 作者: E esterzhou

update doc (10440)

Signed-off-by: Nesterzhou <ester.zhou@huawei.com>
上级 5c7e2458
# Device Information # @system.device
> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** The **device** module provides APIs for checking information about the current device.
> - 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.
> **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. > - 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 ## Modules to Import
``` ```
import device from '@system.device'; import device from '@system.device';
``` ```
## device.getInfo ## device.getInfo
getInfo(Object): void getInfo(Object): void
Obtains the device information. 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. > Do not call **device.getInfo** before the **onShow** event of the home page.
**System capability**: SystemCapability.Startup.SysInfo **System capability**: SystemCapability.Startup.SystemInfo
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- |
| success | Function | No | Called&nbsp;when&nbsp;the&nbsp;device&nbsp;information&nbsp;is&nbsp;obtained | | success | Function | No| Called when API call is successful.|
| fail | Function | No | Called&nbsp;when&nbsp;the&nbsp;device&nbsp;information&nbsp;fails&nbsp;to&nbsp;be&nbsp;obtained | | fail | Function | No| Called when API call has failed.|
| complete | Function | No | Called&nbsp;when&nbsp;the&nbsp;execution&nbsp;is&nbsp;complete | | 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 | | brand | string | Brand.|
| manufacturer | string | Manufacturer | | manufacturer | string | Manufacturer.|
| model | string | Model | | model | string | Model. |
| product | string | Product&nbsp;number | | product | string | Product number.|
| language<sup>4+</sup> | string | System&nbsp;language | | language<sup>4+</sup> | string | System language.|
| region<sup>4+</sup> | string | System&nbsp;region | | region<sup>4+</sup> | string | System region.|
| windowWidth | number | Window&nbsp;width | | windowWidth | number | Window width.|
| windowHeight | number | Window&nbsp;height | | windowHeight | number | Window height.|
| screenDensity<sup>4+</sup> | number | Screen&nbsp;density | | screenDensity<sup>4+</sup> | number | Screen 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 | | 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&nbsp;version | | apiVersion<sup>4+</sup> | number | API 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. | | 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 | | deviceType<sup>4+</sup> | string | Device type.|
The following error code will be returned if the device information fails to be obtained. **Return value of fail()**
| Error&nbsp;Code | Description | | 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** **Example**
...@@ -72,4 +72,4 @@ export default { ...@@ -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.
先完成此消息的编辑!
想要评论请 注册