Called when the Android device reports a new location.
This event is the most important part of the control when using a GPS receiver. Latitude, longitude and altitude are all local variables. Hover your mouse over one of them to capture either a get latitude or set latitude to block or a get longitude or set longitude to block or a get altitude or set altitude to block as required. Be aware, the altitude value is notoriously inaccurate as compared to the latitude / longitude. This value can easily be off a lot. Why? A lot of geometry information is being processed, the earth is not a sphere (it is a geoid) which makes this determination difficult. The values appear order of magnitude reasonable for values greater than a hundred meters.
Best practice is to always verify that a sensor exists on a device before you attempt to acquire data from it. Do not assume a sensor exists simply because it is a frequently-used sensor. Device manufacturers are not required to provide any particular sensors in their devices.
See also TimeInterval.
speed units - the LocationSensor reports speed in m/sec units), convert to km/hr if you want speed in kilometers (1000 meters) and also be aware m/sec must be addressed to convert kilometers/hour. m/sec * km/1000m * 60 sec/min * 60 min/hour = km/hour .
Accuracy
Indicates Android device accuracy level, in meters.
AI2 has no control to tell you how many satellites are being used in a fix or how strong the received signals are at the GPS. Instead, AI2 use other information from the satellite data stream to establish a reliability circle, a distance circle with a radius of the indicated accuracy. It only reports the radius of that circle as described below. Your device may be in the center of the circle, you may be on the edge of the reliability circle or in the center. Accuracy demonstrates the quality of the satellite fix by reporting plus/minus x meters accuracy at any moment. Lower values are better.
The Android Developer Reference defines accuracy as “the radius of 68% confidence." If you draw a circle centered at this location's latitude and longitude, and with a radius equal to the accuracy, then there is a 68% probability that the true location is inside the circle. In statistical terms, it is assumed that location errors are random with a normal distribution, so the 68% confidence circle represents one standard deviation. In practice, location errors do not always follow such a simple distribution. This accuracy estimation is only for horizontal accuracy, and does not indicate the accuracy of altitude if those are reported. If this location does not have an accuracy, then 0.0 is returned.
So, when you do a calculation of speed, it will be accurate or not depending on the Accuracy at the time of sampling.