Hey guys. So I am working on an app that does a few things and among that I created a screen that the purpose of it is to always listening and when certain words are spoken the app does some staff. So when the screen opens I do this forever loop and it works just fine but whenever the app failes the understand the word which might happen the forever loop stucks. I tried put error on the label if the speech to text function returns null but it didn’t worked. Any suggestions?
Thanks!
One thing you should probably try here @eladkobitr8f is to use else clauses as part of your first If statement, rather than having multiple if statements like this.
Having something like this running forever will probably run the users battery down pretty quickly - have you considered having a button that would start listening for, say, 30 seconds?
Hey @domhnallohanlon, thank’s for your answer I tried else, I tried to check if the label is empty then continue the loop but it didn’t worked to. And for the battery, yea I would do that but I just need it to be like that for some project. Any other suggestions? Thank’s! (adding photo of an attempt I tried, still the loop stops when the speech to text dosen’t recognize)
Instead of the Forever
loop use a Timer
and let it listen every second or two.
Thank you @muneer ! That fixed it up.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.