In the house we now have a bunch of android tablets fixed into the walls where most of the light switches would have been. To get things working I initially wrote a “simple” Android application to turn on and off the lights via the Vera 3 box that manages the Z-Wave network they are all attached to. Having said this I don’t think the phrase “simple” can really be applied to any Android App as even such a simple application as this wasn’t easy to write from scratch. I had to learn about application lifecycles and fragment lifecycles and all sorts of delphic (I chose this term because I’m sitting in Corfu writing this) stuff. And even after I’d finished it I realised it was a pretty poor effort – even though it supports both vertical and horizontal orientations it crashes when you change screen orientation on my Samsung phone (fortunately you can’t rotate the tablets as they’re fixed into the walls). What is clear though is that I do want an application that can be run on a phone (and possibly a PC) as well as on the tablets.
Perhaps unsurprisingly I’ve been putting off improving the app for the wall tablets as I didn’t really fancy reminding myself of all the Android nonsense. But having got the window shades working with their own MBED web server I felt I really needed to support them on the wall tablets and found myself thinking about writing an updated app.
how about Qt on Android?
getting started with PhoneGap
PhoneGap’s development approach is a little unusual these days in that it is all command-line based. Essentially, once you’ve set it up, you create a new project using the command “create” and you build using the command “build” – pretty logical I guess.
The trickiest part of getting PhoneGap set up was getting the Android environment to work with the PhoneGap command line. This required a lot of jiggling to get the environment variables JAVA_PATH, ANT_PATH and PATH set so that all the required tools can be found during build. I haven’t tried PhoneGap Build as yet simply because it just adds another step and I’m only targeting one platform right now.
So I’ve been working quite happily on an application using PhoneGap, CoffeeScript and LESS and really quite enjoying it. I’ve ended up building the entire DOM contents dynamically and the structure of the software is pretty much as I would want it to be if it were developed with Python and a good UI framework.
It really is quite surprising how much like Python my CoffeeScript code is looking and I’m really happy with it. I’m close to finishing so plan to blog about it separately … so stay tuned.