Search code examples
iphonesdkuialertviewiphone-sdk-4.1interruption

how to continue recording automatically if interrupted by an uialert such as text message, push notifications, or low battery status, etc


I have a voice recording app on iPhone OS 4.1. I notice that the app stops recording (maybe because it loses focus) when any alert such as text message or timer or alarms or push notifications and most importantly, low battery alerts, pop up. Question is, as soon as the user dismisses the alert (ok or cancel) how can I get the app to continue recording from where it left off without having the user to press any button again. Bottomline, how do I get the app to continue whatever it was doing in the foreground before the UIalert interruptions without any additional user inputs.

I have seen this on netflix and hulu+ apps where the video is paused when any alert pops up, but the video automatically continues when the popup is dismissed by the user.

I am not looking at any private APIs please.

Any help would be greatly appreciated.


Solution

  • You should look into handling these issues in the -applicationWillResignActive and -applicationDidBecomeActive methods of your Application delegate. These methods will fire before and after, respectively, those minor interruptions occur.