I’ve created a very simple app to help out on my hike, it’s main features are:
- Tell me my progress along the trail (both the overall km and the percentage).
- Update my map marker on the blog homepage.
This small project came about for two reasons. The first is that I wanted a straightforward way to update an app marker on my website. I originally thought this would be simple, using Google Maps and some API to set a marker’s location (for my purposes here you can think of an API as the ability to send commands over the internet). However it turns out that there is no such Google API for setting markers on a custom map, at least not one that I could find. I then switched to using MapBox for this map, is it is much more customisable, and it’s easier to work with programmatically (to do things such has setting a map marker). It would be possible to update a Google map marker by manually opening a map, editing it and moving a marker. However this would be quite awkward to do on a phone, and could potentially use a lot of mobile data (to load the map). With my solution it’s very quick and easy with just the push of a button (and will use almost no mobile data).
The second reason for the app is that I wanted to try out some of the latest Android development stuff. When working as a developer, you don’t often get the opportunity to try out the latest tools and frameworks unless you start a new project. These things can often be a lot of work to change in an existing project and so it’s rarely deemed worthwhile to update older projects to the “latest and greatest”. Because of this, if developers want to try out new things, they often create smaller projects such as this one.
Using the phone GPS location in combination with the route data, I can calculate (accurately enough) how far I am along the trail, what that is as a percentage of the whole trail and roughly how far away I am from the nearest point on the trail.
If you’re interested, feel free to take a look at the code at this GitHub repository.