I had a voip app which uses call kit. When a call is started I enabled proximity monitor.
[UIDevice currentDevice].proximityMonitoringEnabled = YES;
When a video stream is added I disabled the proximity monitor. The problem is that the screen is still turn black when I get my phone near to my ear even the proximityMonitoringEnabled is set to NO.
Note if I disable call kit, the proximity monitor is working as expected.
One more strange thing is if i remove proximityMonitoringEnabled from my code and enable call kit, the screen is turning black when I get my phone near to my ear, during the call.
I am facing this issue on an iPhone 7 iOS 11.0.3.
You can use disable/enable proximity monitoring during the call using AVAudioSession
. To disable proximity monitoring setup mode AVAudioSessionModeVideoChat
, to enable it use AVAudioSessionModeVoiceChat
. Be careful, these modes works only with AVAudioSessionCategoryPlayAndRecord
.
P.S. I don't think that it is important, but tested only with AVAudioSessionCategoryOptions.rawValue == 0