Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Emulator - How to emulate headset plugging action

Android Emulator - How to emulated headset plugged.

  1. Is it possible to simulate the action of a headset being plugged in?

  2. Basically, I want this intent fired - Intent.ACTION_HEADSET_PLUG. Is there any other way to do this other than simulating a headset being plugged in?

like image 524
jumpa Avatar asked Aug 03 '11 06:08

jumpa


People also ask

How can I use microphone in Android Emulator?

hi try by enabling the audio recording support while creating the virtual device in emulator... While creating device go to hardware part and select new button. A dialog will appear in which select the property combo and select "Audio Recording Support" and give k and apply...

How do you check if headphones are plugged in android programmatically?

AudioManager audioManager = (AudioManager)getSystemService(Context. AUDIO_SERVICE); audioManager. isWiredHeadsetOn(); (Don't worry about the deprecation, it's still usable for ONLY checking if the headset are plugged in.)


1 Answers

From the official reference on Android emulator:

Emulator Limitations:
In this release, the limitations of the emulator include:

  • No support for device-attached headphones

Perhaps you could test it with mock objects and events? (JUnit?)

like image 148
iDroid Avatar answered Nov 15 '22 06:11

iDroid