The current issue of the German c’t magazine was in my post box this afternoon, and I went to get it when Joerg Wende pointed out that it carries an article which explains how to use the Android Tasker app to periodically publish a device’s location to a Web page in a way similar to how Google Latitude used to operate. Does that sound familiar to you? :-)
Apart from Tasker costing a few Euros, and aside from the fact that it’s Android only, there are plenty of issues with that article, but instead of complaining, I’ll show you how you can use OwnTracks to do similarly, albeit with a number of benefits including immediate reporting of location change. If you’re new to MQTT, I’d like to suggest you start reading here for a bit of an introduction.
We’re going to create a small program which subscribes to the broker and writes the last obtained location into a file.
Our little program decodes the JSON payload it receives and uses the
lon values therein to write the URL to the map into a file.
The resulting file contains something like this:
Our Web page will, when loaded, use that file to load Google map into an
iFrame, though we won’t write the code for the latter (
it’s in the magazine Update: example here).
If you take into account that OwnTracks is free of charge, and that it reports a device’ (Android and iPhone) location when movement is detected, I believe we have the better solution. We’re also able to detect geo fences (leaving or entering an area of arbitrary radius around a point), and you can set your broker to allow friends and family to see eachother’s location
Interested? Read about OwnTracks, get the apps, and off you go! Enjoy.