This tutorial assumes you at least know the terminology around Glass.

There are two APIs to choose from when designing for Glass; the Mirror API and the Glass GDK.

Mirror API

The Mirror API is what Google originally released with Glass and provides a simple way to send timeline items to Glass and receive them from the user using a server. The Mirror API can send text, HTML, images and streamed video to the user but is intended for services like news providers and social applications. The API is run only on a server and doesn’t actually need to be physically downloaded onto glass, the user simply needs to permit the service to send information to their glass using their Google account on any computer.

The service can also receive timeline items the user explicitly shares with it by automatically creating a share contact that the user can send things to as if your service was another Glass user. This is how things like Google+ and Facebook work; they create a contact called Facebook Friends or g+ circles and when you share things with those contacts it gets sent to the relevant server. The Mirror API may also send updates to dynamically change the content on timeline cards, or delete them. In addition, it can send bundles which act like cards with submenus and can specify the menu options of each card independently such as whether the user may share it, reply to it etc. The Mirror API will work with Java, PHP and Python and runs from a server.

Glass Development Kit

The GDK is for developing native Apps and it is much more powerful. It will give you full access to all of Glass’ sensors, its camera and a bluetooth connection with a paired android phone. The GDK is designed for Apps that make sense to run locally and possibly offline or with minimal latency. For example, a navigation app that requires to continue functioning when the user is offline and needs to be real time.

To install apps using this API, the user needs to pair their glass with an android device and download the app from the Google Store. Once installed on the Android; the app will automatically sideload the Glass app contained within it onto Glass.

Doing this requires both apps to be signed with a release key and for development, it is much easier to just plug Glass directly into the computer and upload the app directly – which will not require a release key. Obviously, the user cannot be expected to do that however. Once the app is installed on Glass it must be explicitly launched by the user. An app created with he GDK can create timeline cards akin to the Mirror API, can create Live cards (which appear to the left of the clock and are real time updated) and immersions (which are used for things like games and occupy Glass fully, allowing for highly customised UI). The GDK can only be written in Java using a special Glass module for the Android SDK.

Glass Development Kit

Getting started with Android

Ok, first thing’s first; If you have never developed for Android before – you are most certainly going to need to do a tutorial on that before you begin on Glass.

The first thing you’re going to need to do is download the SDK and an ide. You can use Android Studio to develop for Android. Once you have done that – you should do the standard introductory Android tutorial as opposed to anything centered around Glass as they all assume you’ve done this tutorial.

Once you’ve got your simple Hello World program running on an android device; a good place to start messing around and getting yourself familiar with the API is to dynamically print the value of a sensor such as the accelerometer on the screen. The API reference for this is quite clean and well written.

Getting started with Glass

When you’re done with that – you should make a hello world app for Glass. It can be difficult to find one though that is still working (the API had a backward incompatible change). Also, Google’s sample programs have a lot more to them than is preferable for an introductory program. The simplest being a stopwatch with multiple views. This beeps as it counts down and lets the user set its starting value.

Hello World program can be found here in this tutorial.

If you’re having trouble getting Glass to work on your computer; first don’t forget to go in and enable debugging on your Glass device; it’s under Settings->Device Info. Getting your IDE to find Glass may be difficult if Window’ default Android drivers are not properly configured.  Here are two good sources of help on the matter:

How to install native apps on Glass

Google Glass Developers Jump Start

Once you’ve got that working you should experiment with the sensors on Glass again since they’re so simple to use. Beware though that Glass can get quite hot and lose battery quickly, especially if you do too much processing. This can happen in the event that the sensor triggers because those events are fired incredibly often.

Regardless of what you’re doing; the Glass API and the Android API pages are going to be your essential references.

If you need to uninstall applications see the end of this tutorial.


A Final Word

At Greenfinch Technology we keep up with modern technology so you don’t have to. We are always trying to push beyond where our competitors are. We do this so to be able to offer the best services to our clients.

If you would like a modern, forward-thinking IT company to help with your custom enterprise software solutionsweb or mobile app development, a BPM such as Siskin or any Cloud technologies please feel free to contact us at 01 818 2949 or email us using our contact form. We will help guide you safely through the process of advancing your company beyond your competitors.

Greenfinch Technology

Greenfinch Technology