Search code examples
androidwebrtcquickbloxandroid-audiomanager

Quickblox Audio call using ear speakers Android


I am implementing Quickblox WebRTC calling . All is successfully implemented, but I want the audio call through ear speakers of the phone. By default, it is only on loud speakers. How can I enable calling through ear speakers like any other calling app? I also tried this:

    AudioManager m_amAudioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE);  
    m_amAudioManager.setMode(AudioManager.MODE_IN_CALL); 
    m_amAudioManager.setSpeakerphoneOn(false); 

But still didn't worked for me!


Solution

  • To switch the audio socket you need to call the switchAudioOutput(); method on your current version it switches between the loudspeakers and phone speakers (if the headset is on, then it switches between the headset and the loudspeakers)