Reputation: 898
I have a quiz application in which the duration of each question is 20 sec. It works fine, but in case, if a user gets a call while playing, I want to pause the application & set it in background. Does anyone have any idea?
Upvotes: 1
Views: 1859
Reputation: 1281
When user gets a phone call in iphone application automatically goes into applicationDidEnterBackground state.for example if you are working on radio app then radio automatically get off when user get any call after call ended application comes into below method(appDelegate.m)
Upvotes: 0
Reputation: 7845
It depends on the implementation of your app but, broadly, your application should stop any running timers, pause the game, pause any sound playback, etc. in the applicationWillResignActive
: method.
When the call is finished, your app is invoked again and the applicationDidBecomeActive:
method is called. You should resume timers, sound playback, etc. from that method. If it's a game, you should not resume it automatically; keep it paused and wait for the user to resume it manually to comply with Apple's UX guidelines.
Upvotes: 2
Reputation: 89509
When a call comes in, your application is suspended.
And you'll know this is happening because your "UIApplicationDelegate
" will get a message of "applicationWillResignActive:
". When it comes back, you can start up where you left off or you can bring up a new question or whatever you want to do, it's up to how you decide to implement your quiz app.
Upvotes: 1