【问题标题】:Flutter iOS, native screen is displayed in the backgroundFlutter iOS,后台显示原生屏幕
【发布时间】:2021-03-26 16:36:55
【问题描述】:

我正在创建一个颤振插件来使用 Twilio API 进行 WebRTC 调用。在 iOS 端,我使用 CXProvider 和 CallKit 来拨打/接听电话。我的问题是,原生呼叫屏幕 UI 总是在后台启动,而我的 Flutter 应用程序停留在前面。

Here a demo video :

我真的不明白这种行为。

这就是我显示传入通知的方式

    func reportIncomingCall(from: String, uuid: UUID) {
        let callHandle = CXHandle(type: .generic, value: from)

        let callUpdate = CXCallUpdate()
        callUpdate.remoteHandle = callHandle
        callUpdate.localizedCallerName = from
        callUpdate.supportsDTMF = true
        callUpdate.supportsHolding = true
        callUpdate.supportsGrouping = false
        callUpdate.supportsUngrouping = false
        callUpdate.hasVideo = false

        // this display the callInvite UI
        self.callKitProvider.reportNewIncomingCall(with: uuid, update: callUpdate) { error in
            if let error = error {
                print("error", error as Any)
            }
        }
    }

这就是我从本地接听电话的方式

    func performAnswerVoiceCall(uuid: UUID, completionHandler: @escaping (Bool) -> Swift.Void) {
        if let ci = self.twilioVoiceDelegate!.callInvite {
            let acceptOptions: AcceptOptions = AcceptOptions(callInvite: ci) { (builder) in
                builder.uuid = ci.uuid
            }
            
                let theCall = ci.accept(options: acceptOptions, delegate: self.twilioVoiceDelegate!)
                self.twilioVoiceDelegate!.call = theCall
                self.twilioVoiceDelegate!.callCompletionCallback = completionHandler
                self.twilioVoiceDelegate!.callInvite = nil
        }
    }

如果有人有建议,我会很高兴

【问题讨论】:

    标签: ios flutter mobile flutter-ios


    【解决方案1】:

    这就是 CallKIt 的工作原理。尝试在 iOS 上使用 WhatsApp 接听电话。你得到相同的行为

    【讨论】:

    • 如果你看视频,这显然不是想要的行为。例如,当您在 WhatsApp 上接到电话时,情况并非如此。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-02-23
    • 2020-12-04
    • 2020-07-17
    • 1970-01-01
    • 1970-01-01
    • 2021-06-08
    • 2022-11-10
    相关资源
    最近更新 更多