1

I am trying to play a media file and Listening it on Headset, Now I am trying to give a soft button that using for SpeakerOn and Speakeroff.

mAudioManager.setMode(AudioManager.MODE_IN_CALL); 
mAudioManager.setSpeakerphoneOn(true);

I have give permission also in Androidmanifest.xml . But on calling these Apis, Mode is changed and using isSpeakerOn() api it showing the speaker status as we expected but In real time I am still getting sound from Headset only not from Speaker?

Give me some guideline so that we can achieve this switching of sound from headSet to Speaker?

tpg2114
  • 14,112
  • 6
  • 42
  • 57
anshu
  • 165
  • 2
  • 3
  • 13
  • 1
    Your question is quite confusing: THe microphone is the device you use for recording / catching sound, it never produces sound. – Nanne Sep 06 '11 at 11:49
  • sorry Nanne ..Listening on Headset>>>>and with some sofetBUTTON want to enable the speaker so that we can get sound from Speaker only. – anshu Sep 06 '11 at 11:56
  • Check the following links: http://stackoverflow.com/questions/2663108/android-set-speakerphone-on-programmatically http://stackoverflow.com/questions/2119060/android-getting-audio-to-play-through-earpiece thanks Manish – Manish Sep 07 '11 at 07:44

1 Answers1

0

Make sure audioManager.setWiredHeadsetOn(boolean on) set to false.

Jayesh Tembhekar
  • 516
  • 7
  • 13