I'm creating an application which should count how long the user stays without using his device. For that, I have a timer which stops when the app become suspended. But, before stop the timer, I need to test two things:
Incoming Call: The user can answer or reject the call. If he rejects the call, the timer will keep counting. Otherwise, the timer will stop, and when the app becomes activated again, it will show an alert.
The iOS system alerts: Reminders, Calendar events, Low Battery, etc. I need to identify if the app become suspended by one of these kind of alerts.
The app already handles the first case. Everything is working for Incoming Calls.
The problem is that I don't know how to check for the second case. How can I identify if the app became suspended by one iOS system alert? Is there any way of doing this?