How to resume iPhone app after a Phone Call

1.1k Views Asked by At

I am creating an iPhone app in which I am providing a call feature with the help of which a user can call place a call on a specified number. I am able achieve the above feature via open URL.

Now after completion of the call I want to resume the execution of app automatically. Although a user can make a fast app switch in iOS 4.0. but I want this to be done automatically.

I have seen the same behavior in "TomTom" app but I am not sure how this app has achieved it.

Thanks

Sandy

1

There are 1 best solutions below

0
On BEST ANSWER

Apple does not allow you to resume an app after a phone call. What you can however try doing is using a local notification.

After calling the 'call' url handler you will need to start a background task and monitor for a call state change:

CTCallCenter *c=[[CTCallCenter alloc] init];
c.callEventHandler=^(CTCall* call){
  if(call.callState == CTCallStateDisconnected) {
    // do stuff here
  }
}

When you get a call state change, create a local notification to alert the user to resume the app. If the user taps on "view" your application will then come to the foreground. Obviously if the call is longer than 10 minutes this won't work as Apple only allows 10 minutes to background tasks.