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

!3182 Done! 3152:【轻量级 PR】:update zh-cn/application-dev/device/sensor-guidelines.md.

Merge pull request !3182 from wusongqing/TR3152
......@@ -111,3 +111,15 @@
The following figure shows the successful call result when **SensorType** is **SENSOR_TYPE_ID_ACCELEROMETER**.
![en-us_image_0000001241733907](figures/en-us_image_0000001241733907.png)
If the API fails to be called, you are advised to use the **try/catch** statement to capture error information that may occur in the code. Example:
```
try {
sensor.once(sensor.sensorType.SENSOR_TYPE_ACCELEROMETER,function(data) {
console.info("Data obtained successfully. data=" + data);// The call is successful, and the obtained sensor data is printed.
});
} catch (error) {
console.error(error);
}
```
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册