The Cicada project aims to make it easier to write apps for Android
that interact with Apollo bluetooth watches. Right now things are
still in a very rough state (patches welcome!), but here's a quick
introduction to using what's there so far.
The lowest-level part of the Cicada project is ApolloLib: it's a very
thin wrapper to encapsulate the OpenWatch/Apollo interface. Use this
if you just want to have a standalone app and want to make the part of
your app that talks to OpenWatch a bit more legible and less error-
prone. I won't go into it here, but the "HelloCicada" sample app
shows how to build something simple using only ApolloLib:
https://github.com/cicada-dev/cicada/tree/master/samples/hellocicada
However, once you start having multiple apps on your Android phone
that interact with the Apollo device, you quickly find that you need
to manually coordinate between your apps so that they don't grab each
others' button press events and don't push screen updates that stop
each others' watch UIs.
The main Cicada app shell is an attempt to keep the app author from
having to do that coordination, and to provide a central app-picking
and configuration UI. Here's how to build an app for the Cicada
environment:
1) Get Apollo hardware and the special Apollo version of OpenWatch.
(As I write this, these are only available from Fossil.) Install
OpenWatch on your Android device, and pair it with the watch.
2) Install the Eclipse IDE and the Android SDK (with its Eclipse
plugin) on your development machine.
3) Clone the cicada repository from GitHub onto your development
machine:
https://github.com/cicada-dev/cicada
4) In Eclipse, do File > Import... > Existing Projects into
Workspace. Do this for the following project directories:
apollolib/
cicadalib/
cicada/
samples/digitalclock/
5) In Eclipse, create a run target for Cicada (the app shell), and
trigger it to build and launch Cicada on your Android device.
Optionally, do the same thing for the DigitalClock sample, so that you
can try selecting it and running it from the Cicada app list on the
watch.
6) In Eclipse, create a new Android Project for your app. You don't
need to check the box for creating an activity—at minimum, a Cicada
App only needs a service if you don't have a phone-side UI.
7) Right-click your new project in the Eclipse package explorer,
choose Properties, then in the Android > Library section, add
CicadaLib
8) In your project, create a new subclass of CicadaApp to implement
the core UI of your app. At minimum, you need to implement onDraw()
to scribble something on the device canvas so that you can see some
effect when you launch your app.
9) Edit your app's AndroidManifest.xml to define a service entry for
your new app class, something like this:
<service android:name=".(your class name)"
android:label="@string/app_name"
android:exported="true">
<meta-data android:name="org.cicadasong.cicada.apptype"
android:value="APP" />
</service>
The most important Cicada-specific details are the "android:exported",
which lets the Cicada launch your app, and the "meta-data" tag, which
lets Cicada identify your app as Cicada-compatible when you install it
on the Android device.
(The other valid values for the apptype meta-data are "WIDGET" and
"WIDGET_AND_APP", both of which allow your app to be used as a
"widget" by Cicada, in which case your onDraw() would get a canvas
that's 1/3 of the usual display height, so it can be displayed in
combination with other widgets.)
10) Create a Run Configuration for your app, then trigger it to build
and install the app on your Android device. If everything worked, you
should be able to launch the Cicada app shell on the watch, and launch
your new app from the list! (In the app list, use the top right and
bottom right buttons to move the selection up and down, and the middle
right button to launch the selected app. From there, the top left
button should return you to the app list.)
So that's my first draft. Please do comment with problems you
encountered while following these instructions, or things that you
didn't find clear, so we can improve it in later iterations.
Joe