Skip to content Skip to sidebar Skip to footer

Droid Incredible Headphones Detection

I'm developing an Android application for the Droid Incredible. When I plug in my headphones, an icon appears on the status bar, so I presume the phone must know headphones are pr

Solution 1:

I found the AudioManager class on the developer site, it looks to have a helpful method for this, but I have not tested it:

AudioManageram= getSystemService(Context.AUDIO_SERVICE);
boolheadsetEnabled= am.isWiredHeadsetOn();

Solution 2:

You find out when it changes with http://developer.android.com/reference/android/content/Intent.html#ACTION_HEADSET_PLUG

I'm not sure if it's possible to find out if your app is started after the headphones are plugged in/plugged out.

Post a Comment for "Droid Incredible Headphones Detection"