How to turn on the main speaker of the phone and the speaker of the phone at the same time?

23 Views Asked by At

This is my code, when I run it, it switches between the main speaker and the phone speaker (that is, one is activated and the other is deactivated). What should I do to activate two speakers at the same time?

if (isSpeakerOn) {

   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
      audioManager.mode = AudioManager.MODE_IN_COMMUNICATION

   } else {
      audioManager.isSpeakerphoneOn = false
   }
} else {
   if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
      audioManager.mode = AudioManager.MODE_NORMAL

   } else {
      audioManager.isSpeakerphoneOn = true
   }

}
0

There are 0 best solutions below