Sunday, June 14, 2015

Blade Reminder App for Android

In recent years the traditional double-edged safety razor has been gaining popularity.

I've also joined the ever-growing fanbase of safety razors. And to help me keep track of when I last changed my razor blade I've created this Android app called Blade Reminder. The app is pretty simple, showing a list of dates, number of times the blade's been used, and a comment (in case I forget how well that day's face scraping went).

So what's the appeal of the safety razor over more modern inventions? I think most converts would agree that a big factor is the cost. Multi-blade cartridge razors feel like such a rip off in comparison.
  • DE blades cost less than 15€ for 100 (online)
  • Even offline in the supermarket they cost less than 3€ for 10
  • Compare that to the Mach 3, which costs 20€ or more for an 8 pack of blades
  • The initial outlay for a DE razor is more, but it's a sturdier piece of kit
You could make those Mach 3s last a couple of years too, if you don't mind shaving with a dull instrument most of the time.

Cost isn't the only factor of course, since if you want to spend more then a good razor and badger brush can be pricey. I think that once you get the technique down, the safety razor provides a shave that is comparable to a cartridge, but is more comfortable to perform.

Yes, there is a definite learning curve. This difficulty could be another paradoxical reason for the increased popularity of the safety razor. Requiring effort to use something makes people feel like they are not such failures when they finally do gain the necessary skill. It's the "I like using this because it makes me feel less of a n00b"-effect. This article talks about the phenomenon of popular products that require effort to use.

Knowing when to change the blade in a DE razor is something that you have to learn. It tends to take about a week of daily use before a used blade starts tugging at hairs rather than slicing through them. Of course the duration of a blade depends on a lot of factors, such as how stubbly you are and the make of blades, but 5 uses seems to be about average.

At the point the blade starts to dull, one tends to instinctively press a fraction harder. This extra pressure ends up causing nicks and razor burn. By keeping track of the number of times you've used the blade, you get to know when you need to switch it out. Or at least it makes you think about those things.

That's where this app comes in! I started making this months ago, but I it has taken me this long to get round to releasing it. As well as the main spreadsheet-like application I've also added a widget that shows the usage and date from the last time you used the app.

There's another app on the Play store called "Shaving Buddy" that does something similar actually. However it has a lot more features than I needed, with photos and databases of gear and all sorts of bells and whistles. If you prefer that approach, maybe check that app out too.

Creating this app has made me realise just how much effort writing a proper Android app requires. Compared to a game, I mean, which has its own strengths and weaknesses. The tools and the libraries in the Android world have a lot of churn. Google is notorious for throwing new libraries out and then abandoning the old working ones for these new-but-incomplete versions. All the ancient documentation that's out there on blogs and tutorials causes confusion.

Backwards-compatibility cruft is starting to accumulate too, such as the official android command-line tool that still only creates projects for the old deprecated apache-ant-based build system. It's a miracle anyone writes apps actually. The time required to do anything useful, let alone fancy, is overwhelming. Even once it is done, I go back to code and struggle to remember what it all oes (ContentObservers, ContentResolvers, Fragments, Cursors, Loaders, Adapters… argh!). Maybe I just suck at this.

According to these guys, it takes 18 weeks to write an Android app. That includes server-side logic, "monetization strategies", and other complicated stuff I don't do. In my defence, I wrote this app at night and on weekends between bouts of Monster Hunter 3 Ultimate with my son. I didn't see any mention of Defeating Brachydios on that infographic.

Luckily we have a bunch of static analysis tools for Java to help prevent common mistakes, and the Android lint tool helps you avoid incorrect use of the dodgier parts of the Android API. In general writing an app "only" requires bolting together different libraries and functions until it does what you want. When I found myself having to write too much code it either meant I was doing it wrong, or I just shouldn't be doing it at all. The downside to this is that whatever you write today, the next platform version could make obsolete or incompatible tomorrow.

Speaking of obsolete, maintaining backwards compatibility with the old 2.x or 3.x versions of Android seems pretty pointless nowadays. About 85% of the people with Android devices have them running 4.0 and up, and this percentage will only continue to grow. For my old 8-bit remakes I've kept backwards compatibility because when I started, Android Donut (aka 1.6) was still cutting edge. The native C code APIs in Android have not changed at all in the last 5-6 years. The lesson here is to write everything in C, it is future proof! :)

Initially I planned to not use the support libraries, but this meant not taking advantage of back-ported functions from the Lollipop release. I also worry that by sticking with the older code style - ActionBar and pals - the code will become stale once 5.x starts to get a foothold.

A feature I have considered adding to the app was an online backup of some kind. Right now I've included a simple backup option where you can export a CSV file of the data to email to yourself or store on some remote storage service. Aftewards you can re-import that file if you lose the data or want to update the entries on a new device. This doesn't require permissions of any sort since it uses Android Intents. It'd be better to use Google Drive, Dropbox or Owncloud, but this would all require more work as well as requiring the internet privilege, so I've avoided doing that for now.

Here's that link to the app on the play store again, try it out and rate it. The code is also on github, so get those pull requests rolling in.