How to determine the speed of an Android device?

What is the easiest way to find out how fast an Android device is moving?

Also, is there a way to register an intention for speed? Example: intention if a device runs more than 20 miles per hour.

+7
android
source share
2 answers

The easiest way is to get the speed of the device from GPS, more precisely, the time taken to move between 2 points. Fortunately, this has already been done for you with the Location: Location.getSpeed() class, which returns a float at a speed in m / s.

Read more about Android Developer Link for more information.

+7
source share

you can accurately calculate the speed by multiplying the acceleration by the time during which it was applied. this method is very sensitive, so you will have to add some border checking to filter the vibrations.

+1
source share

All Articles