Home > Android, Rate, Sensor > How long is SENSOR_DELAY_GAME?


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.

Categories: Android, Rate, Sensor
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: