diff --git a/Classes/CallView.m b/Classes/CallView.m index 57b8d13da..0edbf1021 100644 --- a/Classes/CallView.m +++ b/Classes/CallView.m @@ -154,7 +154,6 @@ static UICompositeViewDescription *compositeDescription = nil; [self previewTouchLift]; // Enable tap [singleFingerTap setEnabled:TRUE]; - [[UIDevice currentDevice] setProximityMonitoringEnabled:!_speakerButton.enabled]; [NSNotificationCenter.defaultCenter addObserver:self selector:@selector(messageReceived:) @@ -180,7 +179,7 @@ static UICompositeViewDescription *compositeDescription = nil; [super viewDidAppear:animated]; [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; - UIDevice.currentDevice.proximityMonitoringEnabled = YES; + UIDevice.currentDevice.proximityMonitoringEnabled = !_speakerButton.enabled; [PhoneMainView.instance setVolumeHidden:TRUE]; hiddenVolume = TRUE; @@ -212,7 +211,6 @@ static UICompositeViewDescription *compositeDescription = nil; videoDismissTimer = nil; } - [[UIDevice currentDevice] setProximityMonitoringEnabled:FALSE]; // Remove observer [NSNotificationCenter.defaultCenter removeObserver:self]; } diff --git a/Classes/LinphoneManager.m b/Classes/LinphoneManager.m index b9aeae995..55c4357fc 100644 --- a/Classes/LinphoneManager.m +++ b/Classes/LinphoneManager.m @@ -817,6 +817,7 @@ static void linphone_iphone_display_status(struct _LinphoneCore *lc, const char // Disable speaker when no more call if ((state == LinphoneCallEnd || state == LinphoneCallError)) { + [[UIDevice currentDevice] setProximityMonitoringEnabled:FALSE]; speaker_already_enabled = FALSE; if (linphone_core_get_calls_nb(theLinphoneCore) == 0) { [self setSpeakerEnabled:FALSE]; @@ -2600,7 +2601,7 @@ static int comp_call_state_paused(const LinphoneCall *call, const void *param) { } else { AVAudioSessionPortDescription *builtinPort = [AudioHelper builtinAudioDevice]; [[AVAudioSession sharedInstance] setPreferredInput:builtinPort error:&err]; - [[UIDevice currentDevice] setProximityMonitoringEnabled:TRUE]; + [[UIDevice currentDevice] setProximityMonitoringEnabled:(linphone_core_get_calls_nb(LC) > 0)]; } if (err) {