0

I used getspeed method in service and it is giving me wrong outputs.

speed = location.getSpeed();

I tested it well and my speed was around 100 km/hr and get speed method was giving value 25 (value of speed variable was 25) . Why is it so? And yes now my phone is lying still on table and it is giving value as 1.75 . I expected 0 at this time. Why this unknown behavior?

Jackie Chan
  • 782
  • 1
  • 5
  • 9

1 Answers1

3

value 25 is in meters per second, so by converting it to km/hr we will get:

25(m/s) * 3600seconds (1 hour) / 1000 (meters) = 90 km/hr

that is about your 100 km/hr value. As for lying device on the table, that giving you 1.75 m/s - it's some error, that gps module giving you. It also depends on what device you have. Everything has vulnerability, so don't be perfectionist :)

romtsn
  • 11,704
  • 2
  • 31
  • 49
  • You can check this thread http://stackoverflow.com/questions/9767151/how-to-get-the-most-accurate-possible-speed-from-gps-in-android for example. Also it depends on your device. If it has not so good GPS module, it will always give you some error. – romtsn Apr 21 '15 at 05:31