Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

About Ambient Light sensor in iphone

Tags:

iphone

Thanks in advance.

I got the information about the iphone sensors from http://ipod.about.com/od/ipodiphonehardwareterms/qt/iphone-sensors.htm. But I didn't get information about how to use ambient sensor in iphone

like image 876
Sandy_ios Avatar asked Jun 20 '11 08:06

Sandy_ios


2 Answers

Here's a link to a description of the ambient light sensor hardware with example code that shows how to access it.

like image 85
Brian Pellerin Avatar answered Oct 23 '22 08:10

Brian Pellerin


It is possible, and the framework is public.

You can activate the connection to the sensor like so :

[[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; 

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.

Here is a guide about iPhone sensors : iPhone sensors

like image 28
Nils Munch Avatar answered Oct 23 '22 07:10

Nils Munch