Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get a single accelerometer value

I'm working on adding a calibration feature to an accelerometer-driven game. For the calibration, I need a single value from the accelerometer. Should I register a listener, get the first value it gives me, and unregister it, or is there a better way to get just one value?

like image 637
Computerish Avatar asked Jun 04 '26 05:06

Computerish


1 Answers

Basically there is no way to do get a single value as far as I can tell. What I ended up doing is putting in a variable called lastAccelValue and registering my Activity to listen for accelerometer updates at the slowest possible speed. Each new accelerometer value is stored to lastAccelValue.

like image 196
Computerish Avatar answered Jun 06 '26 18:06

Computerish