Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing the ambient light sensor in iOS

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.

like image 429
Lukas Avatar asked Aug 16 '13 10:08

Lukas


People also ask

How do I turn on ambient light sensor on iPhone?

iPhone adjusts the screen brightness for current light conditions using the built-in ambient light sensor. Go to Settings > Accessibility. Tap Display & Text Size, then turn on Auto-Brightness.

Does iPhone have ambient light sensor?

About brightness levelsiOS devices use an ambient light sensor to adjust brightness levels based on the light conditions around you. The sensor lowers brightness in dark locations and raises brightness in light locations. The auto-brightness feature is on by default.

How do I check the light sensor on my iPhone?

You can test it by: Press the "Home" button and then lock your iPhone by pressing the "Sleep/Wake" button. Move into an area with bright ambient light and use your hand to cover the top third of your iPhone screen. Press the "Home" button and move the slider to unlock your phone.

How do I activate ambient light sensor?

To enable or disable the Ambient Light Sensor (ALS) using the keyboard: Press and hold the Fn key, and press the Left Arrow key to enable or disable ALS. Press and hold the Fn key, and press either the Up Arrow key or the Down Arrow key to disable ALS and set the LCD brightness manually.


1 Answers

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

like image 118
geekchic Avatar answered Oct 20 '22 07:10

geekchic