In order to track our movements and draw a route on the map, we need to create an array of points, each with its own latitude and longitude value. The MapView will take in this array of points as a property called route, and draw a series of lines to provide a visual representation of the route to the user.
In this recipe, we will create a timer that records our location every minute, and adds it to the points array. When each new point is recorded, we will access the Google Directions API to determine the distance and add that to our overall tally of how far we have traveled.
Note
Note that this recipe will not work on Android devices, as there is currently no support for Android routing in Titanium. However, it will work as described here for the iPhone and iPod Touch. There is an unsupported method of routing in Android, which you can read about at http://bit.ly/pUq2v2. You will need to use an actual iPhone or iPod Touch device to test this recipe, as the emulator...