Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-9862

getCurrentAcceleration not working after clearWatch

    XMLWordPrintableJSON

    Details

      Description

      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();
      },

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mauron85 Marian Hello
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: