Closed wiiznokes closed 1 year ago
Was the phone screen locked? I just tested on main branch and the minimized app does not affect the service.\ But if the phone was locked, the service was dead, until I unlock the phone. And this is because that foreground service (which sends audio data) was dead when the activity is down for a while.
When the phone screen is unlocked.
Hmm... this will be hard to debug. Could you double click on the audio display to hide it and then test with minimized app?\ My quick guess is that the GUI rendering was turned off while the app was updating the audio waves.
I figured out what was the problem.
We need to specified the service will use microphone as is mentioned here .
So just add startForeground(FOREGROUND_SERVICE_TYPE_MICROPHONE, notification
in onCreate
of ForegroundService
will solve the issue.
Just tried and it's work even better as expect (even when the screen is locked)
Sounds great! I'll try it. Please submit a PR for this!
The service seems to pause itself after 1 min when the app is minimized. Then if we reopen the app, the stream work as expected.