11

Can anybody tell me what is the difference between SENSOR_DELAY_NORMAL, SENSOR_DELAY_GAME, SENSOR_DELAY_UI and SENSOR_DELAY_FASTEST in Android sensors.

Where should a developer use all these things? What will user feel by using all these?

Samet ÖZTOPRAK
  • 2,428
  • 3
  • 23
  • 26
Prasad
  • 1,295
  • 5
  • 17
  • 31

4 Answers4

26

Here are some approximations based on tested results:

Accelerometer, SENSOR_DELAY_FASTEST: 18-20 ms
Accelerometer, SENSOR_DELAY_GAME: 37-39 ms
Accelerometer, SENSOR_DELAY_UI: 85-87 ms
Accelerometer, SENSOR_DELAY_NORMAL: 215-230 ms
Orientation Sensor, SENSOR_DELAY_FASTEST: 16-17 ms
Orientation Sensor, SENSOR_DELAY_GAME: 37-39 ms
Orientation Sensor, SENSOR_DELAY_UI: 77 ms
Orientation Sensor, SENSOR_DELAY_NORMAL: 224-225 ms

You can also define your own rate, for example 100ms.

int READINGRATE = 100000; // time in us
mSensorManager.registerListener(this, mLinearAccelerometer, READINGRATE);

However the rate is just an approximation, if you need an accurate rate it is better to use a timer.

iFarbod
  • 419
  • 6
  • 21
nabrugir
  • 1,639
  • 2
  • 21
  • 36
6

int SENSOR_DELAY_FASTEST get sensor data as fast as possible int SENSOR_DELAY_GAME rate suitable for games int SENSOR_DELAY_NORMAL rate (default) suitable for screen orientation changes int SENSOR_DELAY_UI rate suitable for the user interface

jsb
  • 319
  • 1
  • 11
  • Thanks for your answer. I have one application reading sensor values with all the above options. There is no difference values between SENSOR_DELAY_FASTEST and SENSOR_DELAY_NORMAL. – Prasad Apr 06 '12 at 13:49
  • yes @Barak is right. the difference is in time. How often the sensors are polled for values. – jsb Apr 06 '12 at 14:01
6

read this
http://developer.android.com/guide/topics/sensors/sensors_overview.html

SENSOR_DELAY_FASTEST 0 microsecond
SENSOR_DELAY_GAME 20,000 microsecond
SENSOR_DELAY_UI 60,000 microsecond
SENSOR_DELAY_NORMAL 200,000 microseconds(200 milliseconds)

jeonggu
  • 103
  • 1
  • 6
0

My results with devices:
Honor 4C Android 5.1.1
Xperia Z3 Android 6.0.1
for Sensor.TYPE_ACCELEROMETER

Approximate values:

For samplingPeriodUs: 0ms:
Honor: 4-12ms, long time(1min) 10ms
Xperia: 1-5ms, long time(1min) 3ms

For samplingPeriodUs: 30ms:
Honor: 4-12ms, long time(1min) 7ms
Xperia: 7-21ms, long time(1min) 20ms

For samplingPeriodUs: SensorManager.SENSOR_DELAY_NORMAL:
Many tests from internet: Accelerometer, SENSOR_DELAY_NORMAL: 215-230 ms
Honor: 4-11ms, long time(1min) 10ms
Xperia: 6-114ms, long time(1min) 14ms

Omitted:SENSOR_DELAY_GAME, SENSOR_DELAY_UI

For samplingPeriodUs: SensorManager.SENSOR_DELAY_FASTEST:
Many tests from internet: Accelerometer, SENSOR_DELAY_FASTEST: 18-20 ms
Honor: 3-12ms, long time(1min) 8ms
Xperia: 1-5ms, long time(1min) 5ms
t0m
  • 2,491
  • 24
  • 46