You can set it through programmatically as below :

AudioManager audioManager = (AudioManager)getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(true);
But, keep in mind that don’t forgot to set speaker off when stop the call:

audioManager.setSpeakerphoneOn(false);

And, Set permission in manifest:

  • android.permission.RECORD_AUDIO
  • android.permission.MODIFY_AUDIO_SETTINGS

This code is working fine for me.hope it will be helpful for you.

You may also like

Leave a Reply