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?
Is there an Intent for READ_ALOUD action in GDK?
Asked Answered
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.
Here's a link to the CompassService class if anyone is interested: github.com/googleglass/gdk-compass-sample/blob/master/src/com/… –
Apocrypha
© 2022 - 2024 — McMap. All rights reserved.