My app uses the speakerphone if no headset is plugged in. If a headset is 
plugged in, Android automatically switches audio playback to the headset. 
However, when the headset is unplugged, the audio plays through the 
earpiece. Is there a way to switch to the speakerphone when the headset is 
unplugged? There does not seem to be any callback when the headset is 
unplugged. 

logcat shows that routing changes to 1 (AudioManager.ROUTE_EARPIECE). I 
could use a timer and keep checking for AudioManager#getRouting, but that 
method is deprecated.

V/HeadsetObserver(  107): Headset UEVENT: {SUBSYSTEM=switch, SWITCH_STATE=0, 
DEVPATH=/devices/virtual/switch/h2w, SEQNUM=6223, ACTION=change, 
SWITCH_NAME=h2w}

W/Vold    (   71): Ignoring unknown switch 'h2w'

V/HeadsetObserver(  107): Intent.ACTION_HEADSET_PLUG: state: 0 name: h2w 
mic: 0

D/AudioHardware(   76): AudioStreamOutALSA::setParameters() routing=1

D/AudioHardware(   76): AudioHardware pcm playback is going to standby.

D/AudioHardware(   76): closePcmOut_l() mPcmOpenCnt: 1

D/AudioHardware(   76): AudioHardware pcm playback is exiting standby.

D/AudioHardware(   76): openPcmOut_l() mPcmOpenCnt: 0

Thanks
Shri

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to