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 and res/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.
HelloGlassService.java will hold the code to launch the activity. onStartCommand will take care of launching our main activity.
MainActivity.java will be the activity that will display the default text.
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.