Search code examples
cordovaaccelerometer

Phonegap Accelerometer Sample Rate


Hi im building a Phonegap App using Accelerometer Data. Right now im getting a sample rate of like 14 Hz, which seems to be very little, since im trying to classify movement data.

With a sensor speed test tool i saw that the speed i have is somehow similiar to the sensor rate SENSOR_DELAY_UI which is a setting that can be picked when registering the sensor. When i change it in the test app to SENSOR_RATE_FASTEST i get around 100Hz.

But how can i set this up from a Phonegap APP?

function startstoptracking(){
         if(sensorAcc == null) {
             $('#button').html('Stop');
             createWriter();
             var options = { frequency: 40 };
             sensorAcc =      navigator.accelerometer.watchAcceleration(accelerometerSuccess,accelerometerError, options);
         } else {
            navigator.accelerometer.clearWatch(sensorAcc);
            sensorAcc = null;
             $('#button').html('Start');
         }
    }

Im happy about any help...


Solution

  • It was not possible that times in phonegap to set a faster rate.