National Rail Train Times

update - 2011/12/08 - National rail have implemented a mobile site that re-directs based on User-Agents. I have uploaded a new APK that sends a Firefox user agent for calls to the NR site and this seems to get things working again. If you've downlaoded this before today, please do it again.

This project uses a local XML config file to offer a list of stations that it will retrieve live running train data for. The data comes from the National Rail website as JSON, retrieved via a simple GET request.

A list of departures is rendered, with each train clickable spawing a webbrowser showing the train's progress. (You're expected to know what destination is appropriate for your journey).

This same functionality can be achieved using browser bookmarks to the relevant NR pages, which I've done for 2 years, but the latency between wanting the information and having it appear on the screen became unacceptably slow (or I have become too impatient). The JSON is fetched and rendered in less than 5 seconds, the bookmark method takes around 30 seconds.

The application needs Internet permission and (due to future planned modifications) it also requires course positional information (using GsmCellLocation). I plan to have it wake me up when I get near home so that I don't end up waking in Ockley again! (;

Thus far the app (or rather the position checking Thread) is already geared up to 'stay awake' when you select a station unless the 'exit' button is used, I now need to build up a list of towers around my home location. Once that's done I'll start looking at how to get the App to realise I'm at 'home'

The application needs this XML file to exist

You can download the APK here

Basic workflow is depicted here:

Valid XHTML 1.1 Strict

If you want an .APK or the source of any of these projects please contact me and ask. I would love to hear from you.