tl;dr – I wrote an Android Wear app. The code’s here.
I really enjoy being in an air conditioned environment. Even more so during the summer.
My optimal daily commute (optimal meaning the train arrives at the station the same time as I do) is sixteen minutes door to door. Eleven of those are spent on the air-conditioned subway train, one is spent walking from my apartment to the subway station and the other four are spent walking to my office. I have it down to a system.
The part I don’t have complete control over is the time at which the subway shows up. Luckily, the line I live on is decently on-schedule. My biggest problem comes from the fact that the timetable for the subway isn’t easily predictable: The C train departs my apartment on the 9s between 9 and 10 AM and on the 1s between 10 and 11 AM. It’s weird. I also never leave my office at a regular time so I can’t even instantly answer the question “If I start walking to the subway station right now, what’s the expected value for how many minutes I have to wait until a train shows up?”
This is a super easy problem to solve. I can simply type my route into Google Maps and it’ll tell me when the train leaves. Fantastic! The issue is it takes me around two minutes to actually complete that operation (I hate the Google Maps app) and very regularly the result of it is “Well, if you hadn’t just spent 2 minutes searching it you would’ve been able to catch a train — have fun waiting 15 minutes for the next one!” This, in theory, is solved by Google Now, which gives me contextually aware advice, including directions to frequently traveled locations. Sadly because I don’t live on a set schedule Google Now normally looks like this for me:
I took that screenshot yesterday when I had waited 5 minutes underground and wanted to see when I was supposed to be expecting the next train. Quite convenient, right? Even worse, when it does consistently show me travel directions to somewhere, it’s “12 minutes to the gym”, constantly shown when I’m at home on the weekends. I can’t bring myself to swipe the card away since that feels like saying “Nah, I’m fine being fat, stop annoying me.” Stop fat-shaming me, Google.
Anyway, long story short, the above is the reasoning that led to the creation of my first Android Wear app.
It’s a stupidly simple app:
- I say “Okay Google, Start MTA” (or tap and select it from the list, which has a bigger actually-working rate)
- My watch tells my phone to figure out where I am. If I’m closer to the GPS coordinates of my office, it assumes I’m on my way home, and the reverse. Note that this assumes a terrible work-life balance. That’s on my task list.
- My phone, using a locally saved timetable, figures out when the next train that will take me to my destination leaves in and sends that info to my watch.
- My watch shows a pretty indicator like so:
As alluded to in my tweet, the creation of this was actually pretty fun. I got home at 7:46, showered, ate dinner, and then got to work. In three hours I was able to make an Android app version of the exact process outlined above. After this, I worked on transferring the data from my phone to an Android Wear app. It took a while, but I think it wouldn’thave if I wasn’t as sleep deprived.
It took me around an hour just to be able to connect my watch to my computer. Obviously, connecting it via the USB cable doesn’t work. You have to set up a bluetooth bridge between your phone (which is connected to your computer) and the device, it’s pretty clunky.
My biggest source of trouble came from the cross-device communication. There are three different ways to do this, and they’re a bit muddled. MessageApi is for the transfer of small ephemeral payloads. DataApi is for the transfer of still small, yet persistent data. And something to do with Assets (I don’t really know what that means or where the documentation about it exists) is for the transfer of big amounts of data, but you know not like “Big Data” with capital letters. The sample code is a bit scatter brained and rushes through this. It also lists out how to two drastically different operations in the same section, which to a sleepy Kasra was insanely confusing.
Once I got past my issue of not being able to read good, it actually wasn’t that bad. There’s an intense personal satisfaction that comes from having an issue, seeing a simple solution to it, and having the solution be in a real product by the time I had the issue again. I’m pretty proud of myself.
If I lived on a numbered train line, this would also be insanely more useful since those trains have real-time tracking rather than just “Maybe a train will show up in 1 minute, maybe not, go fuck yourself.”
Side-note: I did end up using the app in the morning (although starting my day with “Okay Google” made me feel like I was in that Zooey Deschanel Siri commercial, I don’t know if that’s a negative or a positive) — it said “2 min” which was fantastic since I was all ready to head out, but it ended up taking me three minutes to walk across the street due to traffic. I ended up just missing the train. You can’t win them all.