ConnectyCube/android-messenger-app

Sometimes switching to speaker or opposite not working on some devices

mwaked opened this issue · 1 comments

Sometimes switching to speaker or opposite not working on some devices such as Samsung Galaxy Note20 Ultra

    //TODO:- Connectycube
    def version_connectycube = '1.9.2'
    implementation "com.connectycube:connectycube-android-sdk-chat:$version_connectycube"
    implementation "com.connectycube:connectycube-android-sdk-storage:$version_connectycube"
    implementation "com.connectycube:connectycube-android-sdk-videochat:$version_connectycube"
    implementation "com.connectycube:connectycube-android-sdk-pushnotifications:$version_connectycube"
private fun switchAudioDevice() {
    parentActivity?.audioManager?.apply {
        if (selectedAudioDevice != AppRTCAudioManager.AudioDevice.SPEAKER_PHONE) {
            selectAudioDevice(AppRTCAudioManager.AudioDevice.SPEAKER_PHONE)
        } else {
            when {
                audioDevices.contains(AppRTCAudioManager.AudioDevice.BLUETOOTH) -> selectAudioDevice(AppRTCAudioManager.AudioDevice.BLUETOOTH)
                audioDevices.contains(AppRTCAudioManager.AudioDevice.WIRED_HEADSET) -> selectAudioDevice(AppRTCAudioManager.AudioDevice.WIRED_HEADSET)
                else -> selectAudioDevice(AppRTCAudioManager.AudioDevice.EARPIECE)
            }
        }
    }
}

Looks like it is a device-specific issue. Closing...