Gallal
Gallal

Reputation: 4262

How to obtain an accuracy that is more precise than the four provided accuracy constants in Android when listening to sensors?

When developing a compass in android, it is possible to check for reliability of sensors by inspecting the accuracy parameter passed in

onAccuracyChanged(Sensor sensor, int accuracy)

This parameter can only be 0,1,2, or three for

SENSOR_STATUS_UNRELIABLE, SENSOR_STATUS_ACCURACY_LOW, SENSOR_STATUS_ACCURACY_MEDIUM, and SENSOR_STATUS_ACCURACY_HIGH

respectively.

However, I can see many applications on the android market which display a progress-bar gauge that seems to reflect an accuracy that is divisible by more than just 4 values, in other words, these applications seems to indicate an accuracy range that is much more precise than the 4 constants.

How would someone do this?

Upvotes: 0

Views: 1181

Answers (1)

Morrison Chang
Morrison Chang

Reputation: 12121

There are probably using time averaging to return a better or worse result since there are the constants for SENSOR_DELAY_* when you register your sensor listener. If you add another layer of time averaging on top of what the system gives you, you should be able to improve accuracy at the cost of performance.

Upvotes: 1

Related Questions