in both, 1) iPhone goes in Sleep mode 2) Open notification Center
It calls
- (void)applicationWillResignActive:(UIApplication *)application
Is there any way to identify if this method is called because device went in to sleep mode or by opening notification center?
There are some hacks to detect lock/unlock, but nothing official that couldn't break with a future iOS release.