Impossible to make an instantaneous speed GPS speedometer with App Inventor Jordan. The best one can do is take a gps fix at one point, then perhaps a minute later take the fix at another point; calculate the distance between the points and divide by the time between the readings. That is the average speed of travel assuming the Android traverses a straight path.
Several factors prevent instantaneous speed and calculation of speed over small sampling time intervals:
1: the time required for the GPS to acquire a satellite fix (which is variable from a few seconds to over 20 seconds perhaps)
2: the LocationSensor property called Accuracy" (which is a measurement of the statistical probability the GPS actually is where you think the Android is located. Read the LocationSensor tutorial and the Accuracy square part of "
The location sensor object is used to communicate with the global positioning satellite receiver (GPS) in your phone/tablet. When the LocationSensor communicates with the built-in GPS receiver, the GPS can determine the location of your device. The sensor can also work with network/wifi location services. Finding a location using the network uses very different techniques to determine a location. Location means, the device's present latitude and longitude or it can mean your street address.
The 104 tutorial also shows ways to calculate distance between two points.
3) There is no simple calculation method that can produce a distance between point following a path using AI2/ Simple methods are available to calculate straight-line distance between points. If a vehicle makes turns between location fixes, the distance traveled is greater than what the simple distance calculation will provide.
You can have fun calculating speed; however, the measurement will not be precise. The AI2 LocationSensor has no method to calculate speed.
Regards,
Steve