I need to detect whether the plugged in wired headset has microphone or not.
I can check if a headset is plugged in using isWiredHeadSetOn(), but for microphone does not seem to be such a method in AudioManager class.
I have found some suggestions using ACTION_HEADSET_PLUG, but I am interested to find out this information even if the headset has been plugged in before opening my application, this event won’t be fired during the lifetime of my app.
Any ideas regarding this issue? Thank you in advance.
UPDATE:
Go ahead and register
ACTION_HEADSET_PLUGin your activity’sonResume().If user has ever plugged in/out her headset after boot-up, platform will deliver the latest state to your activity when it resumes.
Following test code worked: