Google Glass from a developers perspective

During the last two weeks I have had the opportunity to work on a proof of concept that uses the Google Glass. In this post I will share my experiences with this device from a developers perspective.

Probably everyone has heard about the Google Glass, a wearable computer developed by Google X. The Google Glass has already opened up newpossibilities and raisednumerousconcerns. This post will not be about any of that. This post will focus solely on developing for Google Glass; what are the things that you have to keep in mind and what is so special about developing for Google Glass. If you are more interested in the other topics mentioned above, this post is not for you.

Demo of voice controll manual with Google Glass as a support tool for professional engineers

What is Google Glass?

From a developers perspective Google Glass is nothing more than the next Android device, accept from the fact that it is not the next device. The internals of the Google Glass are very similar to a high-end smartphone from 2011, although the newest version of the Google Glass has two gigabytes of RAM instead of the one gigabyte mentioned in the previous mentioned link. The Google Glass has all the usual components, such as a camera, wifi and bluetooth. What makes the Google Glass so very interesting for developers is not the hardware on its own, but the entire package including the Glass Development Kit (GDK) and the guidelines provided by Google for developing for the Google Glass.

What is so special about the GDK?

As mentioned before, Glass is nothing more than the next Android device, at least from a developers perspective. This means that you could develop your applications using the standard tools. However, Google has created an add-on to the standard Android Developer Tools (ADT), the GDK. This toolkit makes it very easy to create applications that adhere to the design guidelines provided by Google. For instance, creating a scrollable list of views (or cards as they are called) can be easily done by creating your own implementation of the abstract class CardScrollAdapter, after which you can use this adapter in the a CardScrollView. An example implementation of the CardScrollAdapter is given below:

It can be as easy as that! In this sample, the objects of type CardData are simple data containers and the CardSet is a collection of these data containers. Naturally, it is possible to have different implementations of these CardScrollAdapters. For instance, we made an adapter that got dynamically instantiated and loaded images from remote locations lazily. These lazily loaded images should be shown fullscreen on the glass. The default implementation for this would be something like this (replace comment on line 73):

Another cool and easy feature of the GDK is adding contextual voice commands to your application (also known as the “ok glass” menu). It is extremely easy to implement and works very well. It is even possible to define your own voice commands, as long as you use your application has the development permission (please take note: Google does not allow applications that have this permission in their AndroidManifest.xml in the store). What is also very remarkable is the quality of the speech recognition. The custom voice commands are recognized even in noisy environments, as long as the background noise does not consist of human speech.

How to remove gradient from fullscreen image

Of course, there are always little nuisances, especially with new products. One of those little nuisances is the ImageLayout.FULL. It does not only render the image fullscreen, it also adds a gradient to the image, as can be seen in the image below. In the left image, you can clearly see the default gradient added to the image while using the default option for displaying fullscreen images.

AMIS logo with gradient.

AMIS logo without gradient.

On the right, you can see the original image. Currently, there is no Card without this annoying gradient. To fix this problem, we had to go back to ADT and render the image using an ImageView:

Of course, this is not a big “hack”, if it can be called a hack at all, but it is still annoying that it is not possible to use the provided classes for displaying fullscreen images without a gradient. Furthermore, we need to make more changes to the CardSetScrollAdapter to handle everything correctly. For instance, the method getItemViewType should be adapted to handle this new kind of card correctly.

Also the contextual voice input has some little it’s annoying parts. It is not possible to have the “ok glass” text hidden while still listening for the voice command (or at least, not when using the contextual menu as it is intended), nor can it be repositioned. This means that there will always be the text “ok glass” hovering at the bottom of your screen, ensuring that you lose some of that precious little screen real estate you have available.

Last but not least, there is no possibility to use an emulator for Glass. Google does not provide this option and probably will not provide it in the near feature. The supposed reason for this is that it is important to actually test and design your application on the device itself. Although it is very annoying at the beginning, I think in the end it does help you create a better experience.

In conclusion

It is very easy to develop for Google Glass and Google provides some very useful guidelines to help you get started with this new format. The extra implementations in the GDK are very useful and makes developing for Glass a breeze. Of course, there are some things that could be done differently to make developing for Google Glass even more enjoyable, but none of these form real big problems. Besides, everything about Google Glass is still heavily under development, so these little “annoyances” might be gone when you have finished reading this post.

meta

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 206 other subscribers

Email Address

About

AMIS is internationally recognized for its deep technological insight in Oracle technology. This knowledge is reflected in the presentations we deliver at international conferences such as Oracle OpenWorld, Hotsos and many user conferences around the world. Our AMIS Technology Blog, the most referred Oracle technology knowledge base outside the oracle.com domain. However you arrived here, we appreciate your interest in AMIS. Link to our Google+ Profile AMIS