Thursday, April 29, 2010

Tracking the London Marathon

One of the fun things about being a Googler are the opportunities that come along to work on unofficial ad-hoc projects using a bunch of different Google technologies. It’s even better when you get to do it while helping charity. I got the chance to do just that in the lead-up to the 2010 London Marathon.

About a month ago Phong Luu, Jean-Laurent Wotton and I offered to help Stephen Woodford raise some money for NABS. Stephen volunteered to run the marathon, we pitched in by building an application to let people follow his progress.

Why Build New?

Existing tools such as Latitude and MyTracks didn't offer the real-time, high frequency live updates needed to allow anonymous visitors to track a marathon in real time. The goal was to create a simple web app using Street View and Maps that didn't require a login that got updated as Stephen was running.

What We Used
  1. AppEngine was used to create a server to receive position updates during the race.
  2. A purpose-built Android app transmitted updates to the server at a regular interval during the race.
  3. Google Maps and Street View displayed each updated position along the route.
Practical Considerations

Before Stephen took off there were a few practical considerations. In particular I needed to be wary of two things: battery life and data signal availability.

To maintain battery life we made the frequency and minimum distance of our location update requests user configurable. During testing we found that 5 minute intervals over 1km was a good compromise between real-time updates and battery life.

As any Londoner knows, a 3G data signal isn’t something you can take for granted while running (literally) around the city. To account for this I created an upload Service. Each new location was recorded into a Content Provider along with a timestamp. Using a combination of Alarms and Broadcast Receivers, I could then start the update Service at semi-regular intervals - or when a data connection was available - and upload all the pending updates to the server.

The Future

With the 2010 race now over, the team is looking for ways to improve our custom solution to offer a generic tool for future marathons. To do that we'll need to:
  • Update the Android app and AppEngine server to support tracking multiple runners simultaneously and in different races.
  • Add compass direction so that Street View shows the direction the runner is facing.

    No comments:

    Post a comment