Download source code of the article.
Most of the GPS receivers are capable of calculating speed of the device. All most all the GPS enabled phones expose the speed and other information through APIs. In Android we can specify whether we need the speed information while searching for best GPS provider.
The Criteria class provides a method setSpeedRequired to specify whether the provider should provide speed information. Passing true specify the speed information is required and false specify this information is not required. Please note that all GPS providers do not support this feature.
The getSpeed method of the Location class is used to get the speed information. The hasSpeed method returns true is speed information is available otherwise false. The speed reported in meters/second.
The accuracy of GPS speed information depends on many factors. To get more about the accuracy and how the receivers is calculating the speed follow this link.
Happy GPS coding!
{ 1 comment… read it below or add one }
Hi,
I am interested to get device (my android phone) velocity. I’d like to know my speed when I am running/walking. However, I am reluctant to use GPS because I understand that GPS coordinates ( latitude & longitude) are not so accurate.
Is there anyway to calculate the velocity by using Android sensor (accelerometer)?
By any chance do you know has GPS coordinates in android already filtered by Kalman algorithm?
Thank you.