Can the iPhone SDK take advantage of the iPhone's proximity sensors? If so, why hasn't anyone taken advantage of them? I could picture a few decent uses.
For example, in a racing game, you could put your finger on the proximity sensor to go instead of taking up screen real-estate with your thumb. Of course though, if this was your only option, then iPod touch users wouldn't be able to use the application.
Does the proximity sensor tell how close you are, or just that something is in front of it?
Proximity sensors used in iPhones are optical sensors. To give an example, I suppose you've noticed that whenever you answer a call and put it to your ear, the screen goes off. This is to prevent accidental touches while on calls. It also serves other purposes but is majorly used to disable the screen while on calls.
You can turn off and on this (this is on by default) by going to Settings > Display & Brightness. Make sure that your iPhone's case or screen protector does not obstruct with the proximity sensor activity.
Proximity sensor is a small component which can detect a short distance for around 10cm. In iPhone and iPad, this sensor is placed at the top of the screen. It is usually used for dimming the screen to preserve battery while user is answering a phone call.
You can't actually turn off the proximity sensor on an iPhone, so your best option is to make sure it's working properly. Your iPhone's proximity sensor can tell when you're holding the phone up to your ear, and it will shut off the screen, saving battery and preventing your face from accidentally hitting buttons.
There is a public API for this. -[UIApplication setProximitySensingEnabled:(BOOL)] will turn the feature on. BTW, it doesn't seem to be using the light sensor, because proximity sensing would tweak out in a dark room.
However, the API call basically blanks the screen when you hold the phone up to your face. Not useful for interaction, sadly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With