Handle UIApplicationStateInactive condition

When the app is in the foreground and user brings down the notification center and taps on a notification, it behaves like a "resume" when it is actually not. This fixes that problem.