Last Friday the MTA released their realtime subway app SubwayTime along with new APIs that third party developers can use to access realtime data for the 1,2,3,4,5,6 and Grand Central Shuttle.
Several months ago, the MTA shared their plans with the developer community, and provided some sample feeds to start working with. I’ve been eagerly anticipating this development since the first release of NextStop over 2 years ago, so naturally I jumped right on it.
The new realtime APIs are based on Google’s GTFS-realtime which uses protocol buffers to transmit data instead of the more traditional (but less efficient) XML or JSON. Learning to use the new format took a little time, but the real challenge was figuring out how to incorporate realtime data without complicating the NextStop user experience. In addition, one of NextStop’s key benefits has always been the ability to access schedules while “off the grid”, and that’s something I wanted to maintain for a realtime version.
After a little experimentation, I decided to stick with the standard NextStop countdown interface for displaying both the realtime countdowns and the static schedule countdowns. The app uses realtime information whenever it’s available, and now includes a colored dot next to the countdown to indicate what the arrival estimate is based on. The dot is green when the estimate is based on recent realtime information, yellow when it’s based on older realtime information (between 5 and 10 minutes old) and gray when it’s based on schedules.
Naturally, an Internet connection is needed in order to download realtime data, so the “off the grid” problem was even more challenging. The eventual solution was to leverage the iPhone’s geofencing services to automatically download updated data without any user interaction when they are approaching a station. This information is then stored locally so that it’s available for display when they open the app on the platform.
Thanks to the MTA’s early heads up, I was able to complete the majority of coding before the API went public. After the announcement on Friday, I made some final tweaks, and submitted the new version for app store review over the weekend.
If the review process goes well, the new version should be available for download from the App Store in the next week or so. You can follow us on Twitter or Facebook to stay up to date with the latest news.