diff --git a/android/lib/src/main/java/com/waz/media/manager/router/AudioRouter.java b/android/lib/src/main/java/com/waz/media/manager/router/AudioRouter.java index 803a02262..11054e045 100644 --- a/android/lib/src/main/java/com/waz/media/manager/router/AudioRouter.java +++ b/android/lib/src/main/java/com/waz/media/manager/router/AudioRouter.java @@ -475,7 +475,22 @@ public int EnableEarpiece(){ DoLog("EnableEarpiece()"); if (hasApi31()) { - _audio_manager.clearCommunicationDevice(); + AudioDeviceInfo seldev = null; + List devices = _audio_manager.getAvailableCommunicationDevices(); + for (AudioDeviceInfo device : devices) { + if (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_EARPIECE) { + seldev = device; + break; + } + } + if (seldev == null) { + DoLog("EnableEarpiece(): no earpiece"); + return -1; + } + else { + DoLog("EnableEarpiece: setting communication device"); + _audio_manager.setCommunicationDevice(seldev); + } } else { if(!hasEarpiece())