Tag

Glassware

How to Develop Hello World Google Glass Android App 

By | Android, Mobile | No Comments

Google Glass is an augmented reality wearable computer with a head-mounted display (HMD) that is being developed by Google in the Project Glass. It’s looking to reinvent the mobile device scene by providing hands-free Internet/computer access for users on the go. Despite this technology remaining in it’s infancy stage, our early adopter Google Glass App Experts have begun experimenting with the Glass Development Kit (GDK) so we’re thrilled by the potential this game changer has to offer. Below are some simple guidelines to follow to develop your first Google Glass app to leverage this emerging technology and familiarise yourself with the coding.

Developing A Google Glass App

If  you’re comfortable with Android, here’s all you need to know to get started:

  • Get the Android 4.4.2 (API 19) SDK and Glass Development Kit Preview add-on from the Android SDK Manager.
  • On Glass, turn on USB debugging (Settings > Device Info > Turn on debug).
  • Import some GDK samples with the File > New Project > Android Sample Project menu.
  • When you’re ready to create a project for your own Glassware, use these settings:
    • Minimum and Target SDK Versions: 19 (There is only one Glass version, so minimum and target SDK are the same)
    • Compile with: Glass Development Kit Developer Preview
    • Theme: None (ADT and Android Studio usually assign a theme automatically, even if you specify no theme, so remove the Android:theme property from your manifest after creating a project)
  • Don’t know where to start? Read these pattern and developer guides for additional information and helpful process tips.

Developing Hello World Immersion for Google Glass

This section describes how to create a simple hello world application for Google Glass using the GDK. There are two options for how the Glassware should show up on the device: as a live card that is part of the timeline or as an immersion that is displayed outside of the context of the timeline. We are focusing on how to write an immersion.

You might be wondering what is an immersion ? An immersion is basically an Android activity. The name immersion implies that it is not part of the normal Glass timeline. Instead, it takes full control of the device – except for the back gesture (Swipe down). To go back to the timeline you need to leave the immersion.

Google Glass 1

Project Set Up:

Create a normal Android project with the following settings:

  • Set minSDKversion and targetSDKversion to 15 (Android 4.0.3)
  • Set compileSDKversion to “Google Inc.:Glass Development Kit Sneak Peek:15”
  • Do not assign a theme to your application or derive your own theme from Theme.DeviceDefault.

Creating the Immersion:

Let’s create a simple activity. The Card class helps us to create a layout that looks like a timeline card.

Google Glass 2

Launching the Glassware Voice Commands:

After creating the activity, we need a way to start our Glassware. A common way to launch Glassware is to use a voice trigger. Let’s add a simple voice trigger to start our hello world activity.

First we need to declare a string resource for our voice command.

Google Glass 3

The next step is to create an XML resource file for the voice trigger using the previously created string value.

Google Glass 4

Now we can add an intent filter for the VOICE_TRIGGER action to our activity. A meta-data tag links it to the XML file we wrote above.

Google Glass 5

The developer guide requires you to add an icon for the touch menu to the activity (white in color on transparent background, 50×50 pixels)

An App Experts tip: the Glass Asset Studio is a helpful tool to generate these icons.

Google Glass 6

The Final Glassware

Now we can start our Glassware by saying “ok glass show hello world”:

Google Glass 7

Another option to start our Glassware is to use the touch menu and scroll to the “show hello world” command:

Google Glass 8

That’s it, you’re all set! We hope this tutorial has helped Android enthusiasts in developing their first Google Glass App. We look forward to seeing this new wearable experience takeoff. Stay posted for additional blogs on how to build great Glassware.

Have you had the chance to experiment with Google Glass? What are some of the major challenges you’ve experienced? Feel free to give us a shout below!