14

I'm working on a project in which it is really necessary to access the ambient light sensor.

I searched a lot in Google and Stackoverflow, but couldn't find any useful information. Is it even possible to do so?

I also tried to calculate the ambient light value by calculating the brightness out of the camera input, but the results aren't really precise, as the camera makes lot's of adjustments to the images, which distort the results.

dandan78
  • 13,328
  • 13
  • 64
  • 78
Lukas
  • 1,346
  • 7
  • 24
  • 49
  • Do you have any new insights into this? The only answer that is provided suggests to use IOKit, but the iphonedevwiki states that using IOKit results in being rejected by the AppStore. – fancy Jan 11 '16 at 13:50

2 Answers2

8

To read the ambient light sensor data, you need to use IOHID in the IOKit framework (Reference)

http://iphonedevwiki.net/index.php/AppleISL29003

http://iphonedevwiki.net/index.php/IOKit.framework

Community
  • 1
  • 1
geekchic
  • 2,371
  • 4
  • 29
  • 41
  • Hello, thank's for your reply! I already saw that post, but i was not sure, how to include this in my application (as it said, only iOS 3 support,..) . Are there any guides? – Lukas Aug 16 '13 at 10:53
  • I'm not aware of any, sorry :( – geekchic Aug 16 '13 at 11:04
  • 6
    There's an important warning at the top of the IO doc you provided `I/O Kit is a low-level framework communicating with hardware or kernel services. Although it is a public framework, Apple discourages developers from using it, and any apps using it will be rejected from App Store.` – Stephen Paul Nov 11 '16 at 19:50
0

I could be too late to the party but I learn from developer documentation that SensorKit would allow us to do it,

https://developer.apple.com/documentation/sensorkit/srsensor/3377673-ambientlightsensor

Satheesh
  • 10,998
  • 6
  • 50
  • 93