My app plays audio. I would like to support the following:

   - By default, the audio plays using the speakerphone. I can do this with 
   AudioManager.setSpeakerphoneOn(true)
   - The hardware volume buttons control the audio level, and the volume 
   level is displayed with a caption of "In-call volume". I can do this using 
   Activity#setVolumeControlStream(AudioManager.STREAM_VOICE_CALL). 
      - FWIW, I also call AudioManager.setMode(AudioManager.MODE_NORMAL). 
      AudioManager.MODE_IN_COMMUNICATION would be better, but it is Level 11, 
and 
      I need to support older Android versions.
   - If the user plugs in a headset (earphones), the audio switches to using 
   the headset. This requires turning off the speakerphone. However, I don't 
   know if there is any callback which indicates that the user has plugged in 
   and removed the headset.

How can I enable automatically switching between the speakerphone and (if 
plugged in) the headset?

Thanks

-- 
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