A few years ago, in 2012, soon after I accepted a full-time Android developer position, I started working on NC Traffic Cams (in the Google Play Store). It started out as a “hack” to see if I could scrape all North Carolina Department of Transportation (NCDOT) traffic cameras. Consequently, this was also my first time coding in PHP (https://github.com/emuneee/nc-dot-tims-scraper). This quickly turned into something where I wanted to implement my understanding of several Android development concepts of the time:
- Android ListViews + Image Loading + Image Caching
- Google Maps SDK for Android (this wasn’t in Google Play Services at the time)
- Google Analytics SDK (neither was this)
- Holo (the Android 4+ design language)
- HTTP Connectivity
- JSON Parsing
- Fragments (yay!)
- Phone & Tablet layouts
At the time, the Samsung Galaxy S, running Android 2.1 (!) was the hot new Android phone. I had the AT&T derivative, the Samsung Captivate.
Initially, it became a chore. I had to manually run my hacked together PHP script, then export the traffic camera data into a format that I could stuff into the source code, then update the Android app (do things that don’t scale right?!?). Well, I soon after discovered automation and built a backend whose job it was to keep the app updated with the latest traffic cameras added by the NCDOT so that app users had access to the latest imagery. It was at that point that I bootstrapped a Node.js API server to serve the latest cameras to the app, a Java app to periodically query the NCDOT TIMS, and a MongoDB datastore. Some related topics covered during the bootstrapping process:
- Node.js + ExpressJS APIs (I’ve kinda turned into a Node.js fanboy of sorts)
- MongoDB & general NoSQL database concepts
- Deploying to Amazon Web Services (AWS) S3
- XML parsing
In late 2014, my year of free AWS usage ran out, so I took the backend server offline and decided to open source the app. What good is the source code if you can’t share it with the world? You will find the source code to the Android app, Node.js API server, and the Java app at the following GitHub.com repository.
Disclaimers and Quick Notes
The Android app was built using Eclipse + Android Development Toolkit (ADT), the Android Studio based on IntelliJ wasn’t a thing when I started this app in 2012.
This was my first modern Android app, written in 2012, when I had just begun writing code professionally. I look back at the code to this day and truly understand how I’ve grown as a developer over the past few years. Don’t judge me.
Some cool statistics (Google Analytics is embedded in the Android app):
The day that experienced the highest usage: Tuesday, February 12, 2014 – my NC people (especially Raleigh folks) will remember this day as the Great Snowpocalypse of 2014.
On this day 26,000 traffic camera images were served to NC Traffic Cams users. This told me people were interested in viewing near-realtime traffic conditions on their mobile devices. It saved me hours of headache because I was quickly able to see the most congested and snow-covered routes (like the following image), and avoid them completely.
As of today, January 6, 2015, this app has been downloaded and installed 7,700 times and currently, actively installed on about 2,000 Android devices.
When I built the app in 2012, there were around 450 publicly available NCDOT traffic cameras. Today, that number is nearing 700.
The methods and techniques used in NC Traffic Cams form the basis of my Android development experience.
Sidenote: my very first mobile app was Speeed Reader for Windows Moble 5/6.X, one of the first & full featured Google Reader RSS clients for Windows Mobile at the time. (Source Code) I did not make this video.
I have ceased development of NC Traffic Cams and am burning the midnight oil building a beautiful social podcast experience by way of Premo.FM (@PremoFM).
Anyway, I hope the code proves useful.