Search code examples
androidandroid-sensorssensormanager

event.accuracy of SensorEvent is giving garbage values


I am trying to log the accuracy of each sensorEvent that I receive. I am using below code to log it inside the method 'onSensorChanged(SensorEvent event)'

Log.d(TAG, "onSensorChanged: " + event.accuracy);

But unfortunately I am getting the garbage values( some positive numbers and some negative numbers).

As per the android documentation, I should be getting values in range [-1,3].

Any idea why is this happening?


Solution

  • Looks like this issue has been reported and fixed in later versions. I observed the issue with the 4.2 and 4.4.4 versions of android. I tried on AOSP 5.0 , it was not reproducible.