How to enable Voice to Text in Google Glass XE8 or Older Versions

UPDATE : { This is not wanted if you are using Google Glass which runs XE9 or later.
Its better to uninstall the voice search apk if you have installed it on XE9 or later version. Uninstalation command is
adb uninstall com.google.android.voicesearch

}
If you have developed an app for normal Android phone which has a voice to text feature, which you have implemented using Androids native library. The same app will not work on a Google Glass. It will throw a ActivityNotFoundException. Because it cannot find the “ACTION_RECOGNIZE_SPEECH” event.

Intent intent = new Intent(RecognizerIntent.ACTION_RECOGNIZE_SPEECH);

intent.putExtra(RecognizerIntent.EXTRA_LANGUAGE_MODEL, "en-US");

try {
startActivityForResult(intent, requestCode);
} 
catch (ActivityNotFoundException a) {
Toast t = Toast.makeText(getApplicationContext(),
"Opps! Your device doesn't support Speech to Text",
Toast.LENGTH_SHORT);
t.show();
}

For that you have to install the voicesearch.apk manually to the Google Glass
using this command(see link below for apk link)

“adb install VoiceSearch.apk”

The VoiceSearch.apk must be a one that has been extracted from a Andoid 4.0 or later version. Now the exception will not be thrown as the Intent called will be fired from the VoiceSearch.apk.

You can download it the apk here  VoiceSearch.apk

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s