cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marian Hello (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CB-9862) getCurrentAcceleration not working after clearWatch
Date Sat, 24 Oct 2015 21:53:27 GMT
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


Mime
View raw message