Labs Olympics: Automate your life with geocron


*geocron is no longer supported. Check out [IFTTT]( for all sorts of fancy automation stuff.*

Last month for the two-day internal app competition we had at Sunlight Labs, Jeremy, Kaitlin, and I built **geocron**. Jeremy had a specific problem that just needed to be solved. When reaching his Red line Metro station during the commute home, he’d have to physically take out his iPhone and send a text message to his wife, asking to be picked up. Surely, such actions can and should be automated, and that’s where geocron comes in. By combining the Google Latitude API with old-fashioned cron jobs, we’ve created a utility that can send automated email, SMS, or webhook payloads depending on the time of day and the place you’re located.

After signing up, the user is presented with a simple rule creation interface that answers three questions: Where am I? When am I there? What do I want to happen?

Rule creation screen in the geocron web application

Create rules that do things based on your location.

To use geocron, you need Google Latitude running on your phone. For Android devices, this service is built into Google Maps, but you need to turn it on. For iPhones, there isn’t a Google Latitude app yet, but there is a Latitude web app. That means in order for Latitude to work with your iPhone, you need to load up the web app and allow usage of your current location, which isn’t exactly ideal. We hope that with iOS 4 and the ability to run location services in the background, Google will come out with a proper Latitude iPhone app soon.

We used several interesting technologies for the project. Because we already needed to use Google’s Latitude API, we opted to handle sign up completely through Google Accounts and OAuth. For the app itself, we used the excellent lightweight Python framework called Flask. It seems to have been inspired by Sinatra, which powers a few of our APIs here at Sunlight. Last, but certainly not least, we used MongoDB as our backing data store. It was Kaitlin’s first time working with Mongo, and she quickly took to it. Like I’ve said before, things tend to just click when working with it.

You’re probably wondering if you should sign up and trust us with your location data. After all, Google Latitude essentially follows you around, recording where you’ve been, no check-ins required. That’s both a blessing and a curse. Because the app deals with sensitive data, we’re limiting access now to a whitelist. If you’d like to get on that whitelist, send Jeremy a message and include your Google account. While we assure you we have no interest in exploiting anyone’s data, you may want to grab the geocron source and run your own instance.

There’s room for improvement and expansion. The rule creation interface can be more fine-grained, allowing for exact time windows in addition to the presets like “Morning” or “Overnight”. With Android, and now iOS 4, we could provide our own locator apps for phones and bypass Google Latitude completely. But as the app stands, we hope it serves as a sneak peek into a world where geolocation is ubiquitous and constant.