简体   繁体   中英

Get accelerometer values in time

I have to get the accelerometer values in time. I saw the Sensor class and the SensorEventListener but this listener notify only when the value changes and I need a periodic notification (also if the value do not change). Otherwise I would like to continuously read the accelerometer value but it is not possible according to this thread: Get current SensorEvent value

What can I do?

Why do you need to continuously "read" the sensor values even when they are the same as before? If you need to calculate some output on a regular basis, then a better solution might be to set up a timer that triggers on the required intervals at which time you use the values from a set of variables that are updated whenever the sensor values change. That way even if they don't change, the timer will initiate the calculations.

Kaamel

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM