Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Kaushik | |
Old Version | Published before Godot 3 was released. |
Need some serious help here with Godot + Android integration/behavior with speech api.
Previously, I was able to integrate google speech api with Godot,and it worked perfectly. Details: https://github.com/literaldumb/Godot-SpeechToText/blob/master/speechtotext/GodotSpeech.java
Now, I want to do away with the mic dialog which pops up when the google speech engine is triggered. I took this tutorial as reference: Android Speech Recognition Without Dialog In A Custom Activity - Truiton
This is my implemented code: https://github.com/literaldumb/Godot-CustomSpeech/blob/master/GodotSpeech.java
The app crashes as soon as the SpeechRecognizer.createSpeechRecognizer() method is called with the error: java.lang.RuntimeException: SpeechRecognizer should be used only from the application’s main thread.
I took a guess at the above error and exposed the onCreate() method from Godot.java and called the createSpeechRecognizer() method from within onCreate(). The problem still exists.
I need some understanding or workaround or a better approach to achieve the same. Any help is hight appreciated.