tags:

views:

100

answers:

2

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

Also, is there a way to register an intent for speed? Example: intent if the device goes more than 20 miles an hour.

+4  A: 

The easiest way is to get the speed of the device is from the GPS, more specifically the time it takes to travel between 2 points. Luckily this is already done for you with the Location class: Location.getSpeed() which returns a float with the speed in m/s.

See the Android developer reference for more info

James
A: 

you can calculate speed precisely by multiplying acceleration to time it was applied for. this method is very sensitive so you will have to add some border check to filter shakes.

Andrey