1

I'm developing a VOIP app on Android and before start the call, I set audio mode to MODE_IN_CALL, and use STREAM_VOICE_CALL to play sound.

On most phones it works, but it doesn't work on Atrix 4G (MB860), which is running Android 2.2.2.

I changed the mode to MODE_NORMAL and use STREAM_MUSIC and it can play and record, but the sound is played through speaker not the earpiece.

I've tried using setSpeakerPhoneOn(false) to route sound to earpiece,but this makes no difference.

Has anyone had this problem yet?

Any help would be appreciated!

hafichuk
  • 10,351
  • 10
  • 38
  • 53
香 梅北
  • 11
  • 1
  • See http://stackoverflow.com/questions/13960313/android-play-audio-from-earpiece/13961649#13961649 – Michael Jan 06 '13 at 08:58
  • Thanks a lot!But it doesn't work...If I use your code to set routing to earpiece and use STREAM_VOICE_CALL, it play sound to speaker and recorded data is almost mute, except for some noise.If I user STREAM_MUSIC, it play sound through speaker and recorded data is normal, which is the same as before.It seems that using STREAM_VOICE_CALL to play data make recorded date is muted, which is quite strange! – 香 梅北 Jan 07 '13 at 03:17
  • Huh.. were you still setting `MODE_IN_CALL`? Because you shouldn't have to do that, and if you weren't there's no reason why the output stream type should affect the input routing. And regardless it definitely shouldn't be routing the `VOICE_CALL` stream to the loudspeaker. Btw, a tip (which might not be relevant for Froyo) if you're doing a VoIP app is to set `MODE_IN_COMMUNICATION`, use the `VOICE_COMMUNICATION` AudioSource for the input, and `STREAM_VOICE_CALL` for the output. And request 16 kHz mono for both input and output. – Michael Jan 07 '13 at 06:38
  • Maybe somewhere others set `MODE_IN_CALL` explicitly, let me check it! – 香 梅北 Jan 08 '13 at 05:07
  • I checked everywhere in my project and replaced all `setMode(MODE_IN_CALL)` with code using your `serForceUse` method, but nothing different. – 香 梅北 Jan 08 '13 at 05:54

0 Answers0