开发者

Why three (redundant?) accelerometer variations in android sensors

In android, we have Sensor.TYPE_GRAVITY, Sensor.TYPE_ACCELEROMETER, Sensor.TYPE_LINEAR_ACCELERATION.

And it is known from android developer forum that, "The output of the accelerometer, gravity and linear-acceleration sensors must obey the following relation: acceleration = gravity + linear-acceleration"

Do Sensor.TYPE_GRAVITY and Sensor.TYPE_LINEAR_ACCELERATION make use of the same sensor as Sensor.TYPE_AC开发者_JAVA百科CELEROMETER - i.e., the accelerometer? What is purpose of having 3 different constants if the value of one can be deduced using the other using low pass and high pass filters?


It's because TYPE_LINEAR_ACCELERATION and TYPE_GRAVITY are available since API Level 9 (Android 2.3). If you want to build an application in a lower API version, you will only have access to TYPE_ACCELEROMETER (since API Level 3). TYPE_LINEAR_ACCELERATION and TYPE_GRAVITY are really helpful and makes unnecessary to split TYPE_ACCELEROMETER. I deploy for Android 2.2 (API Level 8) and still don't know how to do it!

More info: http://developer.android.com/reference/android/hardware/Sensor.html


If you want more detailed information about those new "fused" sensors, have a look at the answers to this question. There you will find the explanation of the different types of sensors, directly from one of the Google developers working on these topics.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜