my.startDeviceMotionListening
Start listening for changes in the device's orientation.
Parameters
Property | Type | Default | Required | Description |
interval | String | normal | No | The execution frequency of the callback function that listens for device orientation change events. Valid values:
|
success | Function | - | No | Callback function upon call success. |
fail | Function | - | No | Callback function upon call failure. |
complete | Function | - | No | Callback function upon call completion, regardless of success or failure. |
Error codes
Error code | Error message | Further action |
1001 | The system doesn't support the relevant capabilities. | Try again with a different device. |
Sample code
my.startDeviceMotionListening({
interval: 'normal',
success: function (res) {
console.log(res);
},
fail: function (err) {
console.log(err);
}
});