Jens Ackou Jens Ackou - 5 months ago 30
Android Question

Android - in what user case will onAccuracyChanged() trigger?

I'm studying the Android API and bumped into the onAccuracyChanged method.

Googled and searched on StackOverflow but I still don't understand in what occasion the accuracy of a sensor might change.

I tried implementing the code in the answer of the thread below:
onAccuracyChanged, why?

Testing this, I don't have a clue how to trigger this method. Even though it might not be useful in any case. There must be a reason why this was provided in the interface.

So out of curiosity. Does anyone know how I might trigger this call?


An example of a sensor on mobile devices that sometimes needs calibration is a compass.

So you might be able to observe accuracy changed events by experimenting with the sensor type TYPE_MAGNETIC_FIELD.

The results you receive will be from this list:

  1. SENSOR_STATUS_ACCURACY_HIGH This sensor is reporting data with maximum accuracy
  2. SENSOR_STATUS_ACCURACY_LOW This sensor is reporting data with low accuracy, calibration with the environment is needed
  3. SENSOR_STATUS_ACCURACY_MEDIUM This sensor is reporting data with an average level of accuracy, calibration with the environment may improve the readings
  4. SENSOR_STATUS_NO_CONTACT The values returned by this sensor cannot be trusted because the sensor had no contact with what it was measuring (for example, the heart rate monitor is not in contact with the user).

So you can see the states reflect sensors that are either performing well, need to be calibrated, or just don't work.