Skip to content

sud.startAccelerometer ​

JS
    sud.startAccelerometer(Object object)

Starts listening for accelerometer data.

Parameters

  • Object object: Input parameters, see the table below for details

Properties of object:

PropertyTypeDefaultRequiredDescription
intervalstringnormalNoExecution interval of the accelerometer data callback function
typestringaccelerationIncludingGravityNoWhether gravity is included. accelerationIncludingGravity includes gravity, acceleration excludes gravity
successfunctionNoCallback function for a successful interface call
failfunctionNoCallback function for a failed interface call
completefunctionNoCallback function for the completion of the interface call

Valid values of interval:

ValueDescription
gameSuitable for game update callback frequency, around 20ms/time
uiSuitable for UI update callback frequency, around 60ms/time
normalNormal callback frequency, around 200ms/time