I have implemented Android Speech Recognition as a service on Android 4.1 & 4.2 recognition solution in my application, with some minor modification(e.g: 1500ms countdown, mute beep), which works basically fine.
I would like to run this service for hours. I tested a lot this solution and i experienced unexpected stops.
The recognition is running in the background, notification icon is displayed, which indicates, when the recognition service is on. After 10-15 minutes continuous listening without any exception the whole applications stops. (But it happened, after 8 recognition periods as well, after 30 secs.) When it happens, I was able to trace one thing, one more time the thread enters the extended Application class' onCreate()
method, where the logs are printed out, but nothing else works. The displayed notification can't be removed.
I don't have leak related exception during listening or any suspicious log message. Is anyone experienced similar stops? Is anyone has any idea why it happens?
I've tried to restart the service after every 20th (handler) starts to avoid this behaviour, so the service is not running for that long. But the situation is the same.
If you have any suggestion what are the possibilities to run the service for many hours, please share.