WeChat Mini Program API Gravity Sensing


wx.onAccelerometerChange(CALLBACK)


Monitor gravity sensing data, frequency: 5 times/second

CALLBACK return parameters:

QQ截图20170208114315.png

Sample code:

wx.onAccelerometerChange(function(res) {
  console.log(res.x)
  console.log(res.y)
  console.log(res.z)
})