简体   繁体   English

从锁定屏幕接听电话后显示自定义 UI

[英]Show custom UI after answer call from lock screen

I developing a calling app such as Whatapp and skype.我开发了一个呼叫应用程序,例如 Whatapp 和 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)我的问题是,当我的手机被锁定并且另一个用户在锁定屏幕上给我打电话时,我会收到一条通知,如果我滑动通知,则会自动收到电话。(当然使用 callkit)

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??我只是想知道,当我的手机解锁时,是否有可能看到 callkitUI 屏幕与另一个用户给我打电话时相同的屏幕?

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 使用 PUSHKIT + CALLKIT 提升您的 VOIP 应用程序用户体验

CallKit Tutorial for iOS iOS 版 CallKit 教程

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.通过使用CallKit框架,完全由系统决定是否显示来电屏幕。 In only 3 instances that I know of, system provides a call screen for your app.在我所知道的只有 3 个实例中,系统为您的应用程序提供了一个呼叫屏幕。

Known instances when system provides call screens for VoIP calls:系统为 VoIP 呼叫提供呼叫屏幕的已知实例:

  1. When the phone receives a VoIP call from VoIP push notification service.当电话收到来自 VoIP 推送通知服务的 VoIP 呼叫时。 By using CallKit framework, you need to report the new incoming call screen to the CXProviderDelegate object.通过使用 CallKit 框架,您需要将新的来电屏幕报告给CXProviderDelegate对象。

  2. When phone has an active regular (cellular) call and receives a VoIP call.当电话有活动的常规(蜂窝)呼叫并收到 VoIP 呼叫时。 This works if you have set in CXProviderConfiguration that your VoIP app allows handling multiple calls.如果您在 CXProviderConfiguration 中设置了您的 VoIP 应用程序允许处理多个呼叫,则此方法有效。 If you allowed call grouping and call holding, system will provide UI for user to handle switching between regular and VoIP calls如果您允许呼叫分组和呼叫保持,系统将为用户提供 UI 来处理常规呼叫和 VoIP 呼叫之间的切换

  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)当电话有一个活动的常规呼叫,并且用户从后台开始拨出 VoIP 呼叫时,这样,系统呼叫屏幕将保持打开状态以向用户提供 UI 以处理多个呼叫操作(如果您允许在您的系统中处理多个呼叫,则为应用程序)

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.总结是您需要自己为 VoIP 应用程序提供 UI,至少是呼出和活动呼叫屏幕,并根据呼叫状态相应地更新 UI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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