audioManager.abandonFocus(myFocusListener) does not happen fast enough

90 views Asked by At

My app uses the microphone in a service even when the app is in the background

When another app wants to use the microphone, myFocusChangeListener gets called with the value AUDIOFOCUS_LOSS_TRANSIENT in that case i call stop and release on my AudioRecord object and abandon the audio focus.

However the app that is trying to use the microphone (in this case "OK Google" the google talking home screen app) gives me the message "can't open microphone" and I know that is because of my app.

If I click the microphone button again on the google app, it then starts listening normally.

What can be causing this issue, and how can I fix it?

0

There are 0 answers