Commuter's Wrist Watch

I have in my possession a WearOS smartwatch. I used to have a Colmi P8 and even wrote a post about it, but sadly I have lost it. While the firmware of the WearOS watch is decent, nothing beats a home-cooked meal.

With the start of the winter semester this month, a perfect use-case presented itself: my daily commute. It consists of three parts: walking out the door, getting to my bicycle, riding to the train station and then taking the train. Because I am both a cautious person and bad at quick time calculations in my head, I tend to spend a few extra minutes on the train platform, having arrived too early. Therefore, I intended to write a WearOS app that helps me arrive right on time.

If we take the previous description of the commute, we can divide it into 4 time points and 3 segments. What happens once I am on the platform on time is out of my hands (be kind, Deutsche Bahn) and therefore not considered here. My plan was as follows: for the time before and after riding my bicycle, display a simple countdown of when it is time to leave or how much time is left until the train should arrive.

On the bicycle however, I have more control over how fast I ride. To see how I am doing, I wanted to display an indicator that shows the user how far ahead or behind the current position is compared to a pre-recorded reference ride. For example, with a quick glance the user should be able to tell that they are about half a minute ahead.

Quickly jotted sketch of the different app screens

Writing a WearOS app

Time to fire up Android Studio and download a few gigabytes of SDK files! As always, the Android developer docs cover most use-cases. I opted for Kotlin and Jetpack Compose. Flutter would have been nice, but support for WearOS seems a little janky. Also, the functional style of Jetpack Compose is really easy to pick up when you are coming from a React background.

Even though I promised myself to do a minimum viable product first, I dove straight into the creation of a settings screen that allows you to configure the target times for each week day and the desired time buffer before departure and after arrival :)

The most difficult part was to access location data from within a Compose component. I am always a bit sceptical of ChatGPT, but in this case, it was of help. If you are new to a language and framework, it usually gives you the right pointers to the components and APIs to use.

The algorithm for calculating the delay time from the current position is pretty straight-forward:

  1. Locate the closest point of the pre-recorded track with a simple (and slow) linear search
  2. Determine how much journey time has passed on the reference track and on our current ride
  3. Subtract the two values

You can take a look at the actual code in this file.

The finished app

Screenshots of the various countdown stages

Experience report

The first two weeks have been going quite nicely. I use the app daily and have never missed the train nor spent excessive time waiting for it. I added a setting to adjust the riding time, because when I recorded the reference track my average speed was a bit higher than what I consider comfortable, especially when leaving early in the morning.

Wishlist & Conclusion

There are of course still lots of features to be added. If I had unlimited time, I’d be interested in implementing statistics (“How much time did I spend cycling? How does it vary?”) and apply machine learning to the collected dataset. Also, displaying information like train delays or platform changes would be useful. Fortunately, they rarely happen. I am quite content with the little app, and am also grateful to have finished a useful side project with such a low amount of friction.

If you want to try the app , you can find the source code here.

Comments

To add a comment, write an email with this link.