Reputation: 571
I have a very interesting problem.
I was under the impression that when my app uses the microphone, and the Android system process (like incoming or outgoing call) needs the microphone, my app releases it without any consideration.
But i guess that is not the issue anymore, since i have received few complains that when the app is being used and there is incoming call, the other side on the call, can not hear them.
Is there any way to assure that whenever system process requests the microphone, to be released?
Upvotes: 20
Views: 1761
Reputation: 12735
Currently, there is no way to check whether another app requests the microphone. However, there are some workarounds:
onPause()
, so that the foreground app can use it. This won't work if you record audio in a background service.Upvotes: 5
Reputation: 27211
In my case I created background thread that checked incoming bits from microphone. If they would zero (or several seconds data lag) the app interrupt the process. Nevertheless, of course, this is not a "good" solution but might be helpful.
Upvotes: 0
Reputation: 37404
As far as I know, there is no way to know the microphone's state is Busy, Available or if somebody is requesting for it because it's somehow these are responsibility of system to manage processes and resources so keeping this in mind , you can't keep the microphone forever and there so no way you can control it mean you can't mange and detect the request on resources .Following there is some info that might help you.
What you can try is , overcome the all possibilities when system can use microphone like setup a broadcast receiver for call broadcasts and when they triggered release the microphone and when call is done then you can acquire it again.
Upvotes: 0