I am using Sinch to implement a voice call "App to App".
My problem arises when I try to activate the speaker.
I created an instance of audio manager in the onCreate () of my activity:
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
I have a button that activates the speaker, using the following instructions:
final Handler mHandler = new Handler();
mHandler.postDelayed(new Runnable() {
@Override
public void run() {
audioManager.setMode(AudioManager.MODE_IN_CALL);
audioManager.setSpeakerphoneOn(true);
}
}, 500);
The above does activate the speaker, however, it generates very annoying interference or noise.
I have tried to eliminate the line
audioManager.setMode (AudioManager.MODE_IN_CALL); '
and increase the delay from 500
to 2000
as suggested by some response to this problem, but none of this has given me results.
I appreciate your answers.