I have implement an option of Video Conference on my application using the following example: https://github.com/androidthings/sample-videoRTC
basically is is working ve
After many check and investigation i have found the problem. i am answering it here if someone else will have the same problem.
i have notice that the voice is not routed to the speaker but to the ear cap...so i add the bellow code to turn on the speaker and the problem has solved !
audioManager = (AudioManager) this.activity.getSystemService(Context.AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
To answer the question where i put the code, i have actually add a new icon to give the user to switch between headset and speaker.
here is the full code:
toggleSpeakerHeadset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (speakerOn) {
setHeadsetOn();
} else {
setSpeakerOn();
}
}
});
private void setSpeakerOn() {
speakerOn = true;
toggleSpeakerHeadset.setImageResource(R.drawable.headset);
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
private void setHeadsetOn() {
speakerOn = false;
toggleSpeakerHeadset.setImageResource(R.drawable.speaker);
audioManager.setSpeakerphoneOn(false);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}