I made a simple app that responds to vocal commands using PocketSphinx to understand commands and standard Google's library to speak, in a sort of conversation.
It's working well but I have a problem and I'm unable to undesrtand what's happen: after the screen goes off, but maybe it happens also after a while, without talking for a while, when the screen is on but opening another app, the application stops retrieving my vocal commands.
When I unblock the phone and/or return to the application, everything restart to work without problem.
I need that this application works in the same manner also when the phone is in standby, but I can't understand what could be the best solution (the best or simply the possible one):
- does using wakelock could change something?
- does transorming the activity in a service could be the solution?
I tried to disable battery optimization too, and also I tried with an exernal application to impose PARTIAL_WAKE_LOCK to mantain the CPU on, but nothing change.
Does someone has got some experience in this case and can explain me how to do?
Thanks a lot in advance!