Is it possible to access data from the proximity-sensor of the iPhone surface?

0 votes
asked Mar 3, 2009 by thanks

When you hold the iPhone to your ear, it detects that there's something (proximity-sensor) and switches off the display.

is it possible to access this sensor in an iPhone app?

3 Answers

0 votes
answered Mar 3, 2009 by johan

I don't think so.

Rather, there aren't any published API's for it.

Google's voice search uses it, but that caused some fuss as they apparently used some unpublished functions.

http://www.iphonehacks.com/2008/11/iphone-app-news.html

EDIT:

To clarify, there are published API's allowing you to turn it on and off, but nothing that will allow you to detect when it has been triggered.

0 votes
answered Mar 3, 2009 by quintin-robinson

It is possible via undocumented System calls, this is how Google's voice search works on the iPhone to start listening when it is close to your ear (or so i'm told). The API isn't publicly exposed though so although google got the app on the store your app might be subject to more scrutiny.

Sorry I can't tell you exactly what the calls are.

0 votes
answered Mar 28, 2015 by chris-woolfe

I was able to find this functionality in Apple's documentation here, however I haven't tried it yet.

The UIDevice instance also provides access to the proximity sensor state (described by the proximityState property). The proximity sensor detects whether the user is holding the device close to their face.

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...