sud.startGyroscope
JS
sud.startGyroscope(Object object)Starts listening for gyroscope data.
Calling
startGyroscoperepeatedly triggers the fail callback. CallstopGyroscopeto stop first, then start again.
Parameters
- Object object: Input parameters, see the table below for details
Properties of object:
| Property | Type | Default | Required | Description |
|---|---|---|---|---|
| interval | string | normal | No | Execution interval of the gyroscope data callback function |
| success | function | No | Callback function for a successful interface call | |
| fail | function | No | Callback function for a failed interface call | |
| complete | function | No | Callback function for the completion of the interface call (executed on both success and failure) |
Valid values of interval:
| Value | Description |
|---|---|
| game | Suitable for game update callback frequency, around 20ms/time |
| ui | Suitable for UI update callback frequency, around 60ms/time |
| normal | Normal callback frequency, around 200ms/time |
When the interval value is not one of the three values above, normal is used by default.
Parameters of the success callback function
- Object res
| Property | Type | Description |
|---|---|---|
| errMsg | string | "startGyroscope:ok" |
Parameters of the fail callback function
- Object res
| Property | Type | Description |
|---|---|---|
| errMsg | string | Error message |
