# Possible to use iphone's light sensory data?

**URL:** <https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291>\
**Category:** Mobile\
**Tags:** unreal-engine, iOS\
**Created:** [October 29, 2014, 11:02pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291 "2014-10-29T23:02:09Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_5eab7467](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5eab7467](https://forums.unrealengine.com/u/anonymous_user_5eab7467)\
**Post date:** [October 29, 2014, 11:02pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/1 "2014-10-29T23:02:09Z")

</div>

Hi all,

I was wondering if it is possible obtain values from the light sensor(detects light around you to auto adjust brightness) on iphones? Might be useful to implement day/night scene in my game using these values.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a36a29c6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a36a29c6](https://forums.unrealengine.com/u/anonymous_user_a36a29c6)\
**Post date:** [October 30, 2014, 2:46pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/2 "2014-10-30T14:46:45Z")

</div>

I’m interested in this too but I definitely think it will require some custom code if I come up with something il let you know

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_5eab7467](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_5eab7467](https://forums.unrealengine.com/u/anonymous_user_5eab7467)\
**Post date:** [October 30, 2014, 5:13pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/3 "2014-10-30T17:13:12Z")

</div>

wow nice keep me updated im definitely interested to know what you come up with!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_a36a29c6](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_a36a29c6](https://forums.unrealengine.com/u/anonymous_user_a36a29c6)\
**Post date:** [November 1, 2014, 9:11pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/4 "2014-11-01T21:11:47Z")

</div>

Unfortunately it appears this is a private framework in iOS, meaning you can’t really use it for App Store games. The best I could find is, to read the brightness settings from the phone, as they COULD correlate with the light outside. (but no guarantee)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_1c5296b5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_1c5296b5](https://forums.unrealengine.com/u/anonymous_user_1c5296b5)\
**Post date:** [February 26, 2015, 10:07am UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/5 "2015-02-26T10:07:29Z")

</div>

Hi,  
You can try and use this code to set the brightness levels: GSEventSetBacklightLevel(); which requires \<GraphicsServices/GraphicsServices.h\>. This is how one can programmatically adjust the brightness levels. But there is a clause by Apple that if you mess with the brightness, they will remove your application from the app store. Therefore, you can adjust the brightness programmatically only if you are developing a rough app and don’t intend to submit it on the app store.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_79f3cb86](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_79f3cb86](https://forums.unrealengine.com/u/anonymous_user_79f3cb86)\
**Post date:** [September 16, 2019, 12:51pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/6 "2019-09-16T12:51:54Z")

</div>

You can actually use the camera to do this, which is independent of the user’s screen brightness settings (and works even if Automatic Brightness is OFF).  
You read the Brightness Value from the video frames metadata using the camera to find out how bright a scene is. Obviously, it only reads the data that can be “seen” in the camera’s field of view, so it’s not a true ambient light sensor.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0b9d8300](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0b9d8300](https://forums.unrealengine.com/u/anonymous_user_0b9d8300)\
**Post date:** [November 13, 2019, 6:03pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/7 "2019-11-13T18:03:47Z")

</div>

This line will give you those values:

```auto

 NSLog(@"Screen Brightness: %f",[UIScreen mainScreen] brightness]); 

```

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d762b4f7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d762b4f7](https://forums.unrealengine.com/u/anonymous_user_d762b4f7)\
**Post date:** [June 21, 2021, 10:30am UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/8 "2021-06-21T10:30:24Z")

</div>

Apple says to not use the framework directly on iOS. Most likely Apple will reject the app regardless of the justification.

Thanks

---

<div class="post-metadata">

**Author:** ![Erma\_Winter](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/erma_winter/32/88712_2.png) [@Erma\_Winter](https://forums.unrealengine.com/u/Erma_Winter)\
**Post date:** [December 3, 2021, 4:09pm UTC](https://forums.unrealengine.com/t/possible-to-use-iphones-light-sensory-data/14291/9 "2021-12-03T16:09:47Z")

</div>

wow nice keep me updated I’m definitely interested to know what you come up with!

\*\*[Android App Development Company](https://mobilecoderz.com/android-app-development/)  
**[Hire Android app developers](https://mobilecoderz.com/hire-android-app-developers/)**
