Early in the course of developing some of my MetaWatch UI experiments, I started running into problems with coordinating between the multiple watch-compatible apps on my Android phone. My apps were getting button press events through the broadcast intents sent out by an early version of the MetaWatch Manager app. The problem with using broadcast intents for this is that they’re, well, broadcast—all my watch apps would receive the button press event at the same time and often react simultaneously. I could make each app only react to a dedicated button, but it got a bit tedious coordinating all that.
Out of this frustration, and from a desire to reduce the boilerplate involved in writing a new apps for the watch, I began to develop a framework that I called Cicada.
Cicada provides a couple of key things for hackers who want to explore app ideas. First, it provides a menu system to pick between watch-compatible apps installed on the phone. Only the app that’s currently on the watch screen gets the button press events. Second, it has a widget mode that lets you run three independent apps at the same time, with each getting one third of the watch screen, so you can mix and match pieces for your watch display.
Here’s a little walkthrough of the Cicada interface on the phone side:
Cicada mostly runs in the background on your Android phone, but it also has a very basic control UI. It’s nothing I’m proud of, but it’s done the job while I’ve been focused on the APIs and plumbing. This is what it looks like when it’s not running.
When Cicada is active, you see a copy of what’s on the watch screen, which is handy for taking screenshots. Here you can see the app list. Pressing the top and bottom buttons on the right side of the watch move the selection up and down, respectively, and pressing the middle-right button launches the selected app. Cicada automatically detects when you install or uninstall watch-compatible apps from your phone, and updates this app list instantaneously.
Now I’ve launched the “Widget Screen” app that’s built in to Cicada. This app has an associated settings UI, as you can see from the button that appeared. (Pressing the upper-left watch button would bring me back to the app list.)
In any case, the widget screen is showing several different apps at once. How did I set that up?
Tapping that settings button on the phone screen brings up the (similarly unvarnished) widget settings view, where you can see the list of apps that were being shown on the widget screen: an app showing the current status of my London tube line, a basic clock, and an app that shows the next appointments from my Google calendar.
Here I’ve tapped one of the widget slots, allowing you to see the list of apps that have declared that they can run as widgets.
I’ve made a few changes in the widget configuration. You can’t see it here, but as I’ve made each choice, the watch display has updated itself so I can see the new look.
Here’s what the new set of widgets looks like on the watch. I’ve moved the clock to the top, and swapped out the bottom widget for an app that shows bus arrival estimates in San Francisco. Now, if I press the lower-right watch button next to the bus times widget…
…it launches the bus times app in full screen mode, showing more detail. (As before, pressing the upper-left watch button would bring me back to the widget screen.) Note that this is the same thing I’d get if I’d chosen “Next Buses” from the initial app menu.
Anyway, that’s a quick look at Cicada. It’s not quite polished enough to put up on the Android Market yet, but if you’re a developer interested in building Android apps for putting glanceable information on the digital MetaWatch, it’s definitely far enough along to be useful to you. You can find the source code for the framework and many sample apps in the Cicada project on GitHub.
To get an idea of what’s involved in writing a Cicada app, have a look at the source for the Digital Clock sample app (less than 100 lines of code, including the license header). You just subclass the CicadaApp service class, implement onResume(), onPause(), onButtonPress(), and draw your watch screen in onDraw().
I’ll write more about Cicada here soon, but if you have any questions in the meantime, post them in the comments below or in the cicada-dev Google group.
Pingback: MetaWatch Experiments | The Incrementalist
Dood, that’s awesome. My metawatch is arriving very soon and I’ll definitely give your framework a try, it sounds great!
I’d love to try out your Cicada applications. I’ve set them up in Eclipse (ApolloLib, CicadaLib, Cicada, DigitalClock, and HelloCicada) using EGit and exported them (i.e. Cicada, DigitalClock, and HelloCicada) to signed .APKs and put them on my phone. I’ve tried running them with and without Meta Watch Manager running – the outcome is the same…
Cicada fails: The application Cicada (process org.cicadasong.cicada) has stopped unexptedly. Please try again.
HelloCicada doesn’t show up in the master list of applications after installation. However using Astro File Manager to find the APK file, clicking and choosing “Open App Manager” I can attempt to run it. Running it produces: Activity not found – com.github.cicada.samples.hellocicada – not surprising as there’s no Activity entry in its manifest. DigitalClock is similar.
I’m really new to this – MetaWatch only arrived 48 hours ago – and would greatly appreciate some pointers as to how to run your samples.
Clearly they must work, otherwise you wouldn’t have put them up, and I’d really like to see them run.
Kind Regards
Steve
Hey Steve, thanks for giving it a shot. When Cicada crashes, can you find the stack trace in the logs (using adb logcat or the logcat view in Eclipse) and send it to the cicada-dev list?
The only app that should be directly runnable after installation should be Cicada itself—most of the sample apps should only appear on the Cicada app menu on the watch, and not the Android home screen.
Looks great. Will the app draw on the analog Metawatch OLED displays in the same manner?
John, I do have one of the ana-digital OLED versions as well, but I haven’t played with it as much yet. Right now most of the work on Cicada has gone into the app menuing and widget system, neither of which would make as much sense without the larger digital display. (So to answer your question, Cicada as it stands now won’t show anything on the OLED displays.)
It’ll be interesting to see what uses people will come up with for the analog version using the MWM intents. You can see one of my previous OLED watch hacks here:
http://headwayblog.com/2009/12/14/telling-time-with-openrealtime-data/
(That app just forced the OLED to stay on as long as the app was active, running down the battery life but making it more glanceable.)
This looks pretty amazing! I’m most of the way through writing a list app that allows you to scroll through and mark things as complete on the watch, think my next step is to make it work with this!
Wow every now and than staying up way to late has its benefits and you run into a gem like this :-) I got my MetaWatch about 11 hours ago and came across this tonight . Looks like you have a remarkable jump into this and i cant wait to try some of your work. Brilliant Idea, I’ll be watching closely let me know if you want any help, I assume that because you open sourced your work and published on git you don’t mind others using and trying it out and possibly furthering some of it?
Hey Todd,
Glad it looks interesting. I’m happy to have other people contributing to Cicada, both in the core runtime or just writing plugins as independent Android apps. Have a look at the project mailing list at:
http://groups.google.com/group/cicada-dev/
Pingback: Hello, MetaWatch! « Android flash
Pingback: Mr. Android » Blog Archive » Hello, MetaWatch!