Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting sensor values per second

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);
like image 982
Laurence Nicolaou Avatar asked Apr 30 '13 12:04

Laurence Nicolaou


People also ask

Which method is used to get sensor power requirements?

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.

What is body sensors on Android phone?

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.

How much battery does accelerometer use?

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.


2 Answers

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.

like image 111
merin_83 Avatar answered Nov 06 '22 02:11

merin_83


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

like image 22
Ivan Shagin Avatar answered Nov 06 '22 03:11

Ivan Shagin