Keep display on when the proximity sensor is covered

Simone Pistecchia picture Simone Pistecchia · Nov 26, 2014 · Viewed 10.9k times · Source

I want to intercept the proximity sensor without turning off the display.

I know by the documentation that I have two Bool variables:

proximityMonitoringEnabled
proximityState

and this code

[UIDevice currentDevice].proximityMonitoringEnabled = YES;

When the proximity sensor detects something it turns off the display, same way it does when you're holding the phone to your ear when on a phone call.

How do I keep the display on when the proximity sensor is covered?

Answer

SierraMike picture SierraMike · Dec 2, 2014

After reading different forums on the topic, its currently not possible for us in the public api to prevent the iPhone screen from going black when the proximity sensor is covered. The only thing you can do with the sensor is tell when its covered or not thru the notification center but again you can't control its natural behavior (When it dims/blacks out the screen).