Initial Impressions of the Glass Development Kit (GDK)

Google released the Glass Development Kit—also known as the GDK—in mid-November. As a Glass Explorer, I was ecstatic to be able to start creating native applications for Glass. As an Android Developer, I was even more pleased to find out that it is built on top of the existing Android SDK. I have been experimenting with it since then and here are my initial impressions of the GDK. Note that I’ll be using the terms “app” and “Glassware” interchangeably but they’ll both be referring to native Glass applications.

Installing the GDK Sneak Peek Add-On was easy to do into using the Android SDK Manager as documented in the GDK Quick Start. The main thing to note here is that Glass has its own custom version of Android which matches API level 15 for Android 4.0.3 aka Ice Cream Sandwich. For each Glass project you create, you will need to make sure that it targets the “Glass Development Kit Sneak Peek” target and not the generic “Android 4.0.3” one. Otherwise you will experience compilation problems since the GDK Sneak Peek target contains the unique Glass classes like the TimelineManager.

targeting_the_gdk_sneak_peek_2

You need to target the Glass Development Kit Sneak Peek target.

Immersions are probably where most developers will start out with since it is basically building an Android Activity. There are some differences you’ll notice immediately though in terms of building out the UI. You will need to remove any Themes that are declared for in the AndroidManifest.xml as this will interfere with the native Glass theme. The wizards for creating new Android apps sometimes put this in by default, so remove any explicit “android:theme” declaration to get the implicit Glass theme.

Another major difference is that there is no Launcher on Glass that is similar to ones on Android or iOS. Instead, there is the voice menu triggered by saying “OK Glass” and an alternative touch menu triggered by single tapping while at the Home card. What this means is that your Glassware can be launched by the user’s voice! All you need to do is specify the phrase that they speak in your AndroidManifest.xml via metadata tag and also specify that a certain Activity (or even Service) will be launched with an intent-filter that specifies the com.google.android.glass.action.VOICE_TRIGGER action.

You can launch your Glassware via a custom voice trigger like "say hello".

You can launch your Glassware via a custom voice trigger like “say hello”.

Speaking of cards, almost everything in Glass is represented as a Card. To the right of the Home card is the History, where all the relatively previous Cards are shown. This is where Cards are inserted using the Mirror API, which is the complementary API for the GDK, allowing web developers to interact with Glass. To the left of the Home card are the current and future cards. Here a user can see Cards which are pinned as well as Live Cards. Google Now cards are special cards that also live to the left of Home, but it seems to me like they would be implemented using Live Cards.

What are “Live Cards,” you ask? They are Cards which can be updated after creation via the GDK. There are actually two types of Live Cards: ones that update their UI with low-frequency and others that update them at a high-frequency. The low-frequency Live Cards are similar to how you create Home screen App Widgets in Android. They have a restricted set of UI due to the RemoteView implementation, but it will probably satisfy 80% of your needs to display data to the user. For the other 20% where you need to create custom UI, you can use the high-frequency Live Card and utilize a SurfaceView.

You also get access to the native hardware of Glass via the GDK, specifically the Camera, Location, and Sensors. One thing to note here is that sensors are relative to the Glass display. Complicating matters is that the Glass display can pivot so that the user can better see the screen but you can’t measure the exact angle of the pivot. This is kind of like if a user was holding their phone at an angle. Also, the user can tilt and rotate their head, just like you can do with your phone. Some Glassware has taken advantage of this to move a virtual cursor around.

We’re just getting started in this new Glass world. I encourage you to download the GDK and get started with it too. You’ll need Glass to be actually test it out. There isn’t a good Glass Emulator as of this writing although there is a demand for it. If you run into problems, ask your questions on Stack Overflow, making sure to tag it with the “google-gdk” tag. Some developers on the actual Glass team at Google are monitoring and answering questions on that tag as well as other Glass developers around the world like myself. Also if you find a bug or want a feature, I encourage you to file those via the google-glass-api public bug tracker.