Recently I’ve messing around with a Google Glass and started working on a small prototype to interface Glass with our internal systems. Let’s build a very simple, Hello World style application, using the GDK.

The features of our application will be:

  • Add a command to the main menu;
  • Use voice to trigger that command;
  • Launch an activity from that trigger.

Let’s start by setting the string that will be added to the menu and be used as a trigger. That code lives in res/values/string.xml andres/xml/voice_trigger.xml.

On AndroidManifest.xml we will declare our activity and the service that will launch the activity on the voice command, along with linking the voice command we just created. will hold the code to launch the activity. onStartCommand will take care of launching our main activity. will be the activity that will display the default text.

So that this post didn’t get too long and bloated, I didn’t paste the code. But you can find it here. This example was built using Android Studio so you might be familiar with the file structure.

Have fun! Play and extend it.

P.S. Google states “Before you begin to use the GDK, you need intermediate or better knowledge in Android development.” I’m assuming the same here: that you have some knowledge and familiarity with Android development.