Reputation: 145
I want to read Acceleration data both with gravity and without gravity.
For the data without gravity, I found that there is a sensor called TYPE_LINEAR_ACCELERATION
.
All the tutorials I have found talk about reading the data with gravity first, and then filtering out the gravity afterwards.
Which way is better?
Upvotes: 0
Views: 291
Reputation: 1006724
TYPE_LINEAR_ACCELERATION
is certainly a lot easier. However, it was added in Android 2.3 (API Level 9). If your objective is to support only API Level 9 and higher, I would suggest TYPE_LINEAR_ACCELERATION
. If you are still aiming to support older devices than that (which may not be worthwhile), you will have no choice but to go the old way of subtracting out gravity yourself from TYPE_ACCELEROMETER
.
Upvotes: 1