ios - Flutter iOS,后台显示原生屏幕
问题描述
我正在创建一个颤振插件来使用 Twilio API 进行 WebRTC 调用。在 iOS 端,我使用 CXProvider 和 CallKit 来拨打/接听电话。我的问题是,本机呼叫屏幕 UI 始终在后台启动,而我的 Flutter 应用程序保持在最前面。
我真的不明白这种行为。
这就是我显示传入通知的方式
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
}
}
如果有人有建议,那将是一种乐趣
解决方案
这就是 CallKIt 的工作原理。尝试在 iOS 上使用 WhatsApp 接听电话。你得到相同的行为
推荐阅读
- c# - 如何从动态用户控件的内容页面上查找控件
- java - 反应堆:使用装饰调度程序或订阅者上下文传播线程局部变量的线程安全方法?
- angularjs - 从页面将参数传递给 Angular 控制器
- sql - 将具有匹配数据的行组合成一个字符串
- redux-form - 尝试从“redux-form”导入减速器时出错
- c# - 为什么将文件上传到 Slack 的两种(几乎)相似的方法(使用 c#)会导致不同的结果?
- c# - 如何在不丢失 CefSharp 浏览器的情况下最小化和最大化 WinForms 表单?
- filehelpers - FileHelpers 问题 - 如何在没有换行符或分隔符的情况下读取固定长度文件
- css - 如何在 .NET Framework 项目中禁用 SCSS 编译文件
- html5-canvas - Canvas 中奇怪的视图框字体大小调整行为