Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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_ACCELEROMETER - 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?

like image 330
user682765 Avatar asked Nov 14 '22 17:11

user682765


1 Answers

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

like image 121
gian1200 Avatar answered Dec 29 '22 22:12

gian1200