You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Marian Hello (JIRA)" <ji...@apache.org> on 2015/10/24 23:53:27 UTC
[jira] [Created] (CB-9862) getCurrentAcceleration not working after
clearWatch
Marian Hello created CB-9862:
--------------------------------
Summary: getCurrentAcceleration not working after clearWatch
Key: CB-9862
URL: https://issues.apache.org/jira/browse/CB-9862
Project: Apache Cordova
Issue Type: Bug
Components: Android
Affects Versions: 1.1.0
Reporter: Marian Hello
After navigator.accelerometer.clearWatch method call navigator.accelerometer.getCurrentAcceleration is not calling callbacks.
How to reproduce:
onDeviceReady: function() {
var watchID;
var options = { frequency: 3000 }; // Update every 3 seconds
function onSuccess(acceleration) {
navigator.accelerometer.getCurrentAcceleration(onCurrent, onError);
navigator.accelerometer.clearWatch(watchID);
setTimeout(start, 1000);
}
function onCurrent(acceleration) {
alert('Acceleration X: ' + acceleration.x + '\n' +
'Acceleration Y: ' + acceleration.y + '\n' +
'Acceleration Z: ' + acceleration.z + '\n' +
'Timestamp: ' + acceleration.timestamp + '\n');
}
function onError() {
alert('onError!');
}
function start() {
watchID = navigator.accelerometer.watchAcceleration(onSuccess, onError, options);
}
start();
},
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org