5

I need to calculate Speed with which the user is moving. So we need two things to calculate speed which are GPS and Accelerometer.

But both have their limitations.

1)GPS is not available all the time.While I getting the current location of user always I am getting from Network provider only and not from GPS.

2)Accelerometer is not accurate.

So which approach should I go with?

Ali
  • 56,466
  • 29
  • 168
  • 265
koti
  • 3,681
  • 5
  • 34
  • 58

3 Answers3

9

The most accurate results can be obtained by using both of them, through sensor fusion. See my previous answer to question Using accelerometer to calculate speeds or to another question GPS V.S. accelerometer to calculate distance.

As for the accuracy of the accelerometer, see Get velocity from 3DVector using accelerometer sensor.

If you want to track the user indoor, see what you can actually do at question Android accelerometer accuracy (Inertial navigation).

Community
  • 1
  • 1
Ali
  • 56,466
  • 29
  • 168
  • 265
3

You can call .getSpeed() on the locationprovider

Buneme Kyakilika
  • 1,202
  • 3
  • 13
  • 34
-2

An implementation, based on the GPS, is available at this link

gprathour
  • 14,813
  • 5
  • 66
  • 90
Shishir Shetty
  • 2,021
  • 3
  • 20
  • 35
  • 2
    The link is dead now. It is always recommended to add the content on SO and provide a reference link of the original post for more details. – Zeeshan Oct 14 '16 at 14:49