swan.onDeviceMotionChange

API 实现差异 解释:监听设备方向变化事件。频率根据 swan.startDeviceMotionListening() 的 interval 参数。可以使用 swan.stopDeviceMotionListening() 停止监听。

方法参数

Function callback

callback参数说明

示例

在开发者工具中预览效果

扫码体验

请使用百度APP扫码

图片示例

代码示例

-

  1. Page({ onLoad() { swan.onDeviceMotionChange(function (res) { console.log('请在真机中预览效果'); console.log('onDeviceMotionChange', res); }); }});