3

I'm confused. This says that getSpeed only returns a value set with setSpeed.

But other sources seem to indicate that getSpeed should actually return a speed. The android docs say that getSpeed "Returns the speed of the device over ground in meters/second." Other sources too seem to say that it works to return the speed of the device, e.g.

http://comments.gmane.org/gmane.comp.handhelds.android.devel/125386

Detect a speed in android

Which is correct? I can't seem to get getSpeed to return a non-zero value, so if it does work, what are some common sticking points that I might be screwing up? I have the manifest set correctly, I believe.

Community
  • 1
  • 1
chris
  • 31
  • 2

1 Answers1

0

Speed calculation uses GPS, so you should use GPS location provider and have GPS satellite fix.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
  • Ok, I get that. I haven't been able to get getSpeed to return a result with a satellite fix and provider. Does getSpeed return the speed calculated by the GPS device? – chris Sep 22 '11 at 00:51
  • use double speed = location.getSpeed(); –  Apr 20 '12 at 08:49