Is it possible to detect a system alert popping up? Such as low power alert.
Is it possible to detect a system alert popping up?
Found it!
When a system alert POP UP, then the function will be called [AppDelegate applicationWillResignActive:], after dismiss the alert then [AppDelegate applicationDidBecomeActive:] will be called. So, it can be detected by add a observer for notifications named UIApplicationDidBecomeActiveNotification and UIApplicationWillResignActiveNotification, such as
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(observeUIApplicationDidBecomeActiveNotification) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(observeUIApplicationWillResignActiveNotification) name:UIApplicationWillResignActiveNotification object:nil];