# wx.startAccelerometer(Object object)

Start from base library version 1.1.0. Please remaining backward compatible.

Starts listening on acceleration data.

# Parameters

# Object object

Property Type Default Value Required Description Minimum Version
interval string normal No The execution frequency of the acceleration data listening callback function. 2.1.0
success function No The callback function for a successful API call
fail function No The callback function for a failed API call
complete function No The callback function used when the API call completed (always executed whether the call succeeds or fails)

Valid values of object.interval

Value Description Minimum Version
game The execution interval of the callback for game updates, which is about 20 ms.
ui The execution interval of the callback for UI updates, which is about 60 ms.
normal The normal callback interval, which is about 200 ms.

# Sample Code

wx.startAccelerometer({
  interval: 'game'
})

# Notes

  • Based on the device performance and current CPU and memory usage, the interval setting may be different from the actual execution frequency of the wx.onAccelerometerChange() callback function.