Getting speed of the device using GPS in Android

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 Response

  1. surya October 25, 2013 / 10:48 am

    This souce code is not working….

Leave a Reply

Your email address will not be published. Required fields are marked *