Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C Linux Android audio Kernel
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
Comments
Ed Nutting at 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 idea...you 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.
 
Ed

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



Advertise | Privacy | Mobile
Web04 | 2.8.141022.2 | Last Updated 24 Aug 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

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