Is there any way that I can get the sensor reading per second? what is SENSOR_DELAY_NORMAL rate in seconds?
sm=(SensorManager)getSystemService(SENSOR_SERVICE);
accelerometer=sm.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sm.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
You can also use the getPower() method to obtain a sensor's power requirements. Two of the public methods are particularly useful if you want to optimize your application for different manufacturer's sensors or different versions of a sensor.
Body Sensors: Allows access to your health data from heart-rate monitors, fitness trackers, and other external sensors. The good: Fitness apps need this permission to provide health tips, monitor your heart rate while you exercise, and so on.
If an accelerometer consumes 0.5mA and a step detector consumes 0.5mA, then activating both at the same time must consume less than 0.5+0.5=1mA.
thank you, it answered my question, too, i was using 1000, seems like the values are in micro seconds.
SENSOR_DELAY_UI (60,000 microsecond delay)
SENSOR_DELAY_FASTEST (0 microsecond delay)
SENSOR_DELAY_NORMAL) (200,000 microseconds delay)
so for one second i should use a constant 1,000,000 micro seconds.
The delay specified by SENSOR_DELAY_* is only a suggested delay, actual results might come faster or slower. If you only need one reading per second you can use the slowest rate (SENSOR_DELAY_NORMAL), it should update about 5 times per second. You'll need your own timing if you want to do something exactly once per second, though.
http://developer.android.com/guide/topics/sensors/sensors_overview.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With