Question

I write a simple app to read accelerometer data and I found that sampling rate is too low(even one sample 5 seconds) when I put phone on the table and keep quiet. I set sampling rate as FASTEST it's sampling rate always is high.

I want to know why and how does Android do this? I guess jni or hardware always read data but it discard data when it find there is no change between two sample.

Was it helpful?

Solution

As you can see from the documentation of the sensor listener the procedure onSensorChanged is called when the sensor changed. This means that if you hold the device still the sensor values won't change.

I have to admit that most phones add noise to sensor values and these values are always changing; you should be 'proud' of your phone - it doesn't add a lot of noise.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top