Planning a Google Glass Hackathon

Date posted
1 August 2014
Reading time
10 Minutes
Michael Kemp

Planning a Google Glass Hackathon

As Google Glass is such a new and interesting device we decided to organise an internal hackathon a Glass Hack - to allow people to brainstorm and develop their ideas. Kainos has run hackathons before, and we know that when new technology is involved a significant amount of preparation is required. This post covers a number of obstacles that we faced in planning the hackathon, and dips into the various ways in which you can begin developing for Google Glass. We planned to start by giving developers a crash course in Glass development - just enough training to hit the ground running. The plan was to produce some reading material, a sample app and to present it all at one or more of Kainos's 'White-bag' sessions - a kind of lunchtime learning session. There are two ways to develop apps for Glass. The first is by using the Mirror API. When Glass was first released this was the only way to create apps. It would allow developers to push and pull information from the device and then display it in a card-like interface using simple REST APIs, however this approach is fairly limited, as it does not allow access to the underlying hardware. More recently Google have released the Glass Development Kit. This allows access to the hardware in Glass and also allows real-time user interaction rather than just static cards. The GDK is an add-on to the Android SDK which means developing Glassware should be fairly similar to developing Android apps. As this approach seemed to give the most flexibility in terms of what could be done, this is what we decided to use for the hackathon - although this proved to be a bit more difficult than we first thought. Initially we downloaded Android Studio, an IDE specifically made for Android development. As it turns out (at the time of writing this) this IDE doesn't seem to work very well with the new Google Glass APIs and after a lot of trying to get the sample apps to work it became clear that it was just not going to work well. Luckily Google also provide their Android Developer Tools bundle. This contains Eclipse and all of the other required tools such as AVD for creating virtual devices, and the software development kits for any of the previous versions of Android (including the new Glass Development Kit). After a while we got Eclipse up and running with a number 'hello world' apps running on the Glass itself. The next step was to work out how to allow a group of people to develop apps without all sharing the same device. Unfortunately for us, Google do not currently provide a virtual device to test on in the same way they do with Android phones. Using the Android Virtual Device tool supplied as part of the ADT bundle we were able to create a virtual device based on similar specification as the Glass. There were a number of issues with this - as the emulator was supposed to be for Android development, it was basically a scaled down Android phone. [caption id="attachment_8969" align=" width="600"]...as the emulator was supposed to be for Android development, it was basically a scaled down Android phone. ...as the emulator was supposed to be for Android development, it was basically a scaled down Android phone.[/caption] In theory, Glass apps should work on this but unfortunately this was not the case. One of the issues we encountered was that Glass apps need to be launched using a voice command, and if we installed the app onto the emulator there was simply no way to launch it. We can get around this by adding a few lines of code to the app's manifest.xml file that will display an icon that then allows us to click to launch the app but when this launched, the layout does not display correctly. [caption id="attachment_8970" align=" width="600"]We can get around this by adding a few lines of code to the app's manifest.xml file that will display an icon that then allows us to click to launch the app but when this launched, the layout does not display correctly. We can get around this by adding a few lines of code to the app's manifest.xml file that will display an icon that then allows us to click to launch the app but when this launched, the layout does not display correctly.[/caption] There are a number of posts online relating to Glass emulation but the few that work relate to the Mirror API, or mention that if you do get an app running the UI is broken, Google Maps don't work and touch support needs to be updated. Google provide the Glass Playground that allows developers to experiment with how content is displayed on Glass but again this is just for Mirror API apps. Some developers suggest installing Glass APKs onto an Android device to test Glass apps. This didn't seem ideal for the hackathon, as everyone attending would need an Android phone and also have to install a bunch of APKs on to their device beforehand. Given the issues we encountered, we found there was no substitute for testing on a real device. Luckily we have been able to order two more devices which should make running a hackathon much easier, and we plan to run one in the very near future. With the developer's permission, I will post again about the apps that come out of the first Kainos Glass Hack. You can find more details on getting an early development environment for glass set up here.

About the author

Michael Kemp