0

I'm programming an APP for Android and i can't find the boundaries for SensorEvent values on the documentation. Is there any way to know what are the limits or to obtain the device limits?

Thanks!

Motheus
  • 533
  • 5
  • 21

2 Answers2

1

The short answer is that you can query for Sensor objects representing all sensors in the system via SensorManager then look at the max range and min/max delay values. But, this is most likely not enough for what you're interested in seeing. The next best thing is to look at the HAL sources (the libraries used in the platform to interface with the kernel drivers.) Each sensor type has different axis and value meanings and the comments in the HAL headers are where it is documented:

AOSP HAL headers

Larry Schiefer
  • 15,687
  • 2
  • 27
  • 33
  • Couldn't find any specific answer within the HAL headers, so I found that actually `getMaximumRange` will do the job. – Motheus Mar 14 '15 at 05:53
0

The other question isn't specific as the values aren't specified in the HAL headers but the HAL interface is documented here

In the HAL the maxRange is documented as:

"The maximum value the sensor can report, in the same unit as the reported values. The sensor must be able to report values without saturating within [-maxRange; maxRange]."

So I guess the getMaximumRange() value will work.

Motheus
  • 533
  • 5
  • 21