The dude The dude - 4 months ago 10x
iOS Question

Detect if a brightness change on iOS was a user action or automatic action

I've seen that I can detect changes in screen brightness by registering as an observer for


- (void)viewDidLoad
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(brightnessDidChange:) name:UIScreenBrightnessDidChangeNotification object:nil];

-(void) brightnessDidChange:(NSNotification*)notification
NSLog(@"Brightness did change");

The object property of the notification is a

I've tried to find a property that lets me know if the action was user generated or if it was an automatic change produced by iOS. This is important for my app since both situations should be treated differently. I did not find anything about this in the documentation. Any help will be appreciated.


I think it is not possible, we can only get notification when Brightness change by the system or manually. we can't differentiate both.