0
votes

I am writing a VoIP app which uses CallKit for when the app is in the background. Largely everything works fine, and CallKit does a nice job of pushing the app when it is in the background during an incoming call.

As far as I understand, once in the background and all outstanding tasks have been finished, the app goes into 'hibernation' and stops communicating with the outside world. The only way now for the app to come back alive is when the iOS operating system tells it to -- when an incoming VoIP call is detected by the operating system, it will pass this on to the app and the app will come back alive and take the call.

My question is: occasionally my app crashes or the user gets logged out, in which case it cannot take calls. If it's in the background when this happens, how can I find out? I'd like some way of telling the caller that he can't call because the receiver is unreachable? iOS operating system will still try to push.

1

1 Answers

0
votes

If you are using PushKit ( which is actually the recommended way to implement silent push notification ) below delegate function will be called when a push notification arrives to the system.

func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType, completion: @escaping () -> Void)

The above function will be preceded by

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool

when the application is terminated or crashed when push notification arrives.

The concept of VoIP push notification is to wake up the app in most energy efficient way. So it will help you to wake up the subscriber to notify about call.