6

I want to build an iOs app like f.lux. It changes the screen brightness of device based on daytime. I know I have to jailbreak my device. But I don't know how to implement this app.

Please suggest me any useful API to do that.

Thanks in advance.

Huy Duong Tu
  • 7,798
  • 5
  • 25
  • 46
  • 3
    What you want to do can't be done in an approved App Store app. – rmaddy Apr 15 '13 at 04:44
  • Is the purpose of your app simply to dim the screen for _any_ running application? If so, that is something best left to the system itself, see my answer below. – Stuart M Apr 15 '13 at 04:46
  • 1
    Just an FYI, F.lux doesn't change brightness, it changes the display temperature (increases/decreases the blue levels) – Parker Jan 20 '14 at 01:50

3 Answers3

1

iOS already has that system-wide feature built-in: see Settings > Brightness & Wallpaper, under Auto-Brightness:

auto brightness

Although it is possible to programmatically control the device's brightness, there is not a public API for determining the outside light, so this is functionality that the OS handles.

Stuart M
  • 11,458
  • 6
  • 45
  • 59
  • 1
    he said programmatically – Tushar Koul Apr 15 '13 at 04:48
  • I understand that, but my point is that this functionality is already present in the operating system itself and an app is not needed to accomplish it. – Stuart M Apr 15 '13 at 04:50
  • Volume control is also provided by the device, still there are some cases when you might want to change the volume programmatically – Tushar Koul Apr 15 '13 at 04:53
  • And to echo @rmaddy's comment, being able to set the brightness still doesn't allow one to know the ambient light outside the device and set it accordingly. So this is something best left to the system to handle. – Stuart M Apr 15 '13 at 04:57
  • @Stuart is right, I upvoted his answer. – Anthony C Apr 15 '13 at 05:03
  • Doesn't auto-brightness work based on ambient light levels, NOT time of day as requested in the question? – Tim Apr 15 '13 at 08:37
  • The question has since been edited, it originally asked about changing based on outside brightness – Stuart M Apr 15 '13 at 09:10
-1

Try this (iOS5 and greater only):

[[UIScreen mainScreen] setBrightness:1.0];

From related question: Adjust the brightness of the screen through code

Community
  • 1
  • 1
Anthony C
  • 1,990
  • 3
  • 23
  • 40
-1

Go through the brightness property of UIScreen which is a new API available after IOS5.

lreddy
  • 449
  • 6
  • 19
  • 1
    This is equivalent to @AnthonyC's answer, right? And in any case, it still does not address the problem of reading the outside brightness (via the ambient light sensor). – Stuart M Apr 15 '13 at 05:32