2013-12-19

A workaround to launch custom apps after XE12 update

Yesterday morning, as usual after coffee, I wore my glasses and made a terrible discovery: both launcher and launchy (custom launchers)  had stopped to launch my custom app. In fact, tapping on Settings, instead of the pop-up menu that usually showed the launcher and launchy, an empty menu appeared.

Googling the web I noticed that a new firmware version called XE12 had just been released, so I started hating the auto-update function...


With XE12, "Mom google" put us in trouble by breaking the functionalities of the custom launchers.


Since there is still no standard way to  launch non-native in-house developed apps I found a useful trick:


How to launch a non-native app saying "ok glass: _appname_"

  • Inside the manifest file add these tags under the Service or Activity which you want to trigger on your voice command.

<intent-filter>
   <action android:name="com.google.android.glass.action.VOICE_TRIGGER" />
</intent-filter>
<meta-data
   android:name="com.google.android.glass.VoiceTrigger"
   android:resource="@xml/voice_trigger_start" />

  • Create a folder called xml inside res and add a xml file named as voice_trigger_start.xml.
  •  Inside that add these lines:
<?xml version="1.0" encoding="utf-8"?>
<trigger keyword="@string/voice_command" />

  • Open the values folder inside the res folder and edit strings.xml, so it will look like this
<resources>
   <string name="app_name">Your App</string>
   <string name="voice_command">Wayfinding</string>
   <string name="stop">Stop</string>
</resources>

  • Now install the app onto Glass and say: "ok glass, wayfinding" and the app opens.