简体   繁体   中英

Show custom UI after answer call from lock screen

I developing a calling app such as Whatapp and skype. The my question is that when my phone is locked and another user is calling me then from the lock screen I will get a notification and if I swipe the notification then the call automatically received.(using callkit of course)

I`m just a wondering is it possible to see the callkitUI screen same as when another user call me when my phone is unlocked??

That would be really helpful, If anyone know the detail, solutions, or any information regarding it.

I already checked the below documents.

Apple CallKit

ENHANCE YOUR VOIP APP USER EXPERIENCE USING PUSHKIT + CALLKIT

CallKit Tutorial for iOS

here is my code.

func provider(_ provider: CXProvider, perform action: CXAnswerCallAction) {

    action.fulfill()

    print("=================CXAnswerCallAction============")

    self.window = UIWindow(frame: UIScreen.main.bounds)
    let storyboard = UIStoryboard(name: "VoipAcceptUser", bundle: nil)    
    let initialViewController = storyboard.instantiateViewController(withIdentifier: "VoipAcceptUser")     
    self.window?.rootViewController = initialViewController
    self.window?.makeKeyAndVisible()

}

System will not provide their call screens to your app when the app is running in foreground. You must provide the call screens yourself.

By using CallKit framework, it is completely up to the system to determine will it show the incoming call screen or not. In only 3 instances that I know of, system provides a call screen for your app.

Known instances when system provides call screens for VoIP calls:

  1. When the phone receives a VoIP call from VoIP push notification service. By using CallKit framework, you need to report the new incoming call screen to the CXProviderDelegate object.

  2. When phone has an active regular (cellular) call and receives a VoIP call. This works if you have set in CXProviderConfiguration that your VoIP app allows handling multiple calls. If you allowed call grouping and call holding, system will provide UI for user to handle switching between regular and VoIP calls

  3. When phone has an active regular call, and user starts an outgoing VoIP call from background, that way, the system call screen will stay on to provide UI to the user to handle multiple call actions (ofc if you have allowed handling multiple calls in your app)

Summary is that you need to provide the UI yourself for the VoIP app, at least outgoing and active call screens, and update the UI accordingly with the call state.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM