Get one accelerometer value

I am working on adding a calibration function to the game with the accelerometer. For calibration, I need one value from the accelerometer. Should I register the listener, get the first value that it gives me, and unregister it, or is there a better way to get only one value?

+3
source share
2 answers

In principle, there is no way to make one value, as far as I can judge. What I ended up with was introducing a variable called lastAccelValueand registering my activity in order to listen to the accelerometer updates at the lowest possible speed. Each new accelerometer value is stored on lastAccelValue.

+4

Source: https://habr.com/ru/post/1761109/


All Articles