Accessing the ambient light sensor in iOS
Asked Answered
S

2

15

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.

Soapsuds answered 16/8, 2013 at 10:26 Comment(1)
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.Schopenhauer
T
9

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

Thorvald answered 16/8, 2013 at 10:35 Comment(3)
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?Soapsuds
I'm not aware of any, sorry :(Thorvald
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.Isa
W
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

Weyermann answered 19/1, 2023 at 15:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.