Question: 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?

Answer: 
Currently, **there is no way to check whether another app requests the microphone**. However, there are some workarounds:

* If you record sound in an Activity, simply release the microphone in `onPause()`, so that the foreground app can use it. This won't work if you record audio in a background service.
* Pause the recording when there is an incoming call. To detect incoming (and outgoing) calls, take a look at [this excellent answer](https://stackoverflow.com/a/15564021/2829009). When the call ends, resume the recording.
* A dirty hack: If detecting incoming calls isn't enough, you could loop through all running apps and see if they have the microphone permission. As soon as an app with microphone permission is running, pause the recording. Getting all running apps can be difficult. For more infos, look [here](https://stackoverflow.com/questions/30619349/android-5-1-1-and-above-getrunningappprocesses-returns-my-application-packag), [here](https://stackoverflow.com/questions/24590533/how-to-get-recent-tasks-on-android-l/26885469), [here](https://stackoverflow.com/questions/3873659/android-how-can-i-get-the-current-foreground-activity-from-a-service/27642535) and [here for checking the permissions](https://stackoverflow.com/questions/4461504/determine-list-of-permissions-used-by-an-installed-application-in-android).
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.