Click here to Skip to main content
13,591,301 members
Rate this:
Please Sign up or sign in to vote.
I want to detect which application is using the microphone.

Suppose two applications have access to the microphone. For an application to use the microphone, it should have android.permission.RECORD_AUDIO.

With the lsof command, we can detect the microphone is being used, but not the application name that is using it. So we can list down all the currently running applications, then we can check which application has android.permission.RECORD_AUDIO permission, but here is the problem:

Suppose we have two applications named "A" and "B". A can only record voice while B has an option to record voice and maintain network status. As both can record voice, both will have android.permission.RECORD_AUDIO permission. So we can know that both A and B can use the mic, but at present, which one is using the mic? How can I avoid such confusion?
Posted 24-Aug-12 0:49am
Ed Nutting 25-Aug-12 15:21pm
If there is no command to tell you which application is using the mic, then I highly doubt it is possible to do. It is probably a good thing that you can't spy on other applications - security wise not being able to do this sounds sensible. Instead, you could ask the user to close any applications that may be using the mic and include in the message the detected list of possible currently running applications that they should close. I assume your intent was to force close the application using the mic? Very bad could easily cause file corruption etc. on the user's device and/or cause them huge problems e.g. if they were in the middle of an important Skype call I don't think they would appreciate your app just suddenly ending that. Always best to let the user handle which they want to use as they are the USEr. If they choose not to close other applications then that's their choice.


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.180618.1 | Last Updated 24 Aug 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100