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.


2 comments:

  1. Where is the res directory? Do I need to root the device?

    ReplyDelete
  2. Hi Paul,
    There is no need to root your device, the res folder I was talking about is a folder contained in each Android Application Project. This folder contains other folders with resources for your application: GUI layouts, icons, menus, and so fort. If you want more details about an Android Application File Structure you should take a look here:

    http://sofia.cs.vt.edu/sofia-2114/book/chapter2.html

    Assuming you're developing an android app using the Eclipse ADT plugin the RES folder is automatically generated by Eclipse, and it is a subfolder of the root directory of your android application project.

    ReplyDelete