Power consumption of the proximity detector?

I'm considering using the proximity detector in my app as a way to blacken the screen while the app runs overnight. (If there's a better way, let me know.)

Leaving the proximity detector running all the time would be fine for my app, but I'm wondering how this might impact battery life. The detector uses IR, right? That means it needs to transmit IR continuously, and that must use some power?


Instead of leaving it on all the time, I can add a "night mode" that only uses the proximity detector at night when the user likely has the phone on a charger. But what if they don't? If the phone is face-down on the nightstand, wouldn't the IR transmitter still be emitting all night long?


I guess I'm asking for the lowest-power solution for keeping my app running all night. Obviously I want to black out the screen. What's the best way?

Replies

It's not likely to run overnite unless it's on charge. If it's on charge, you're not concerned w/power consumption.


Perhaps if you mentioned what the app is supposed to do (is the proximity detector needed for it's basic use?), someone could offer a discrete suggestion, etc.


Otherwise:

https://stackoverflow.com/questions/12661004/how-to-disable-enable-the-sleep-mode-programmatically-in-ios


Note that use of that timer requires adherence to the 'Important' disclaimer here if you hope to avoid rejection during review:

https://developer.apple.com/documentation/uikit/uiapplication/1623070-idletimerdisabled