Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an Intent for READ_ALOUD action in GDK?

I would like to read some text to the user, just like it's possible in Mirror API. Is that possible in Google Glass GDK via Intent?

like image 421
David Vávra Avatar asked Nov 20 '13 08:11

David Vávra


1 Answers

It's not an intent, but you can use the Android TextToSpeech class for this purpose. Essentially, just create an instance of TextToSpeech and then call the speak method with the string you want it to speak.

There is some initialization overhead involved with the TTS engine so you should try to do it early — you may experience a delay if you try to initialize the engine at the exact moment that you want it to speak.

The CompassService class in the GDK Compass sample shows this in more detail.

like image 110
Tony Allevato Avatar answered Nov 12 '22 03:11

Tony Allevato