开发者

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 w开发者_运维技巧ould someone do this?


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜