and… while we’re at it, how long are the other times?
I’m sure every developer dealing with Android’s sensors comes across this question: what value should I choose for the update frequencies. And why can’t I just “roughly in msec”?
Strangely, I couldn’t find any good results on the web, so here’s my own test results, done with a HTC Legend:
- Accelerometer, SENSOR_DELAY_FASTEST: 18-20 msec
- Accelerometer, SENSOR_DELAY_GAME: 37-39 msec
- Accelerometer, SENSOR_DELAY_UI: 85-87 msec
- Accelerometer, SENSOR_DELAY_NORMAL: 215-230 msec
- Orientation Sensor, SENSOR_DELAY_FASTEST: 16-17 msec
- Orientation Sensor, SENSOR_DELAY_GAME: 37-39 msec
- Orientation Sensor, SENSOR_DELAY_UI: 77 msec
- Orientation Sensor, SENSOR_DELAY_NORMAL: 224-225 msec
If you leave the phone unattended, the orientation sensor will report events only about half as often (but not never).
The test application is a simple sensor listener for the Acceleration sensor that keeps track of time passed and counts the number of invocations of onSensorChanged. Every 1000 (game/normal delay: 100) invocations it writes the time passed. I was measuring time with System.nanoTime, of course.
By the way, the light sensor didn’t want to ever return an event to me, even if the same sensor as a proximity sensor does. Strange.