tags:

views:

221

answers:

1

How can I check if headphones are currently plugged in. I don't want a broadcastreceiver which informs me when they have been connected to the device. I need something like:

if(/*headphone is connected*/)
 ...
+3  A: 

It looks like you'll be interested in the isWiredHeadsetOn() method and isBluetoothA2dpOn() method of the AudioManager class.

However, the isWiredHeadsetOn() method is only available in Android 2.0 or later. (The isBluetoothA2dpOn() method has been available since Android 1.5.)

Dave Webb