Reputation: 886
I am working on an android project where I need to calculate speed of car from android device. For that I try to use GPS, but GPS is able to disabled by user and also the battery consumption by GPS is too high, so that I need to calculate speed using acceleration sensor.
If any one know any API or way to calculate speed then please help me for this.
Thanks in advanced.
Upvotes: 0
Views: 6063
Reputation: 9925
An acceleration sensor can only measure acceleration. To clarify by example: if you are on a plane moving at constant velocity, just like you, the acceleration sensor would feel no force acting (except of course, that of gravity). So there would be no way your app could measure the speed of the plane using only the accelerometer.
Upvotes: 1
Reputation: 4344
What you need is device built in sensors, GPS will always drain you battery. Your are right Accelerometer is your answer, most of the android device has this inbuilt sensor, I would suggest you to couple this sensor along with Gyroscope and Magnetic field sensors for accurate mesurement of sensor.
You can go thought this blog to know about usage of this API.
http://www.vogella.com/articles/AndroidSensor/article.html
Also, Android developer sample code has decent idea about calculating speed, check that as well.
Hope it help.
Upvotes: 0