我目前正致力于为我们提供Agora.io服务
音频,视频,一对一和广播通信
我已经在给定样本的帮助下成功实现了这些,并成功添加了信令模块。问题是信令呼叫必须是活动的才能访问它的所有功能现在我想在应用程序关闭时访问信令的所有功能,如whatsapp和其他这些类型的应用程序一个解决方案是提供信令类服务但这是不专业的解决方案
我想要有效的解决方案
使用任何第三方API都无法做到这一点。这是Apple和Google提供的系统级功能。您必须使用CallKit(适用于iOS)或ConnectionService(适用于Android)来实现此功能。
我几天前完成了同样的事情。
对于iOS,您可以通过以下方式使用PushKit和CallKit: -
0.1。启用后台模式并检查voip。
像这样注册pushkit: -
func registerPushkitToken() -> Void {
pushRegistry = PKPushRegistry.init(queue: DispatchQueue.main)
pushRegistry?.delegate = self
pushRegistry?.desiredPushTypes = [.voIP]
}
3.实现令牌功能
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials:
PKPushCredentials, for type: PKPushType) {
let tokenChars = pushCredentials.token.hexString()
}
实现CXProviderDelegate函数
func providerDidReset(_ provider: CXProvider) {
print("Function: \(#function), line: \(#line)")
sessionPool.removeAll()
}
func provider(_ provider: CXProvider, perform action: CXStartCallAction) {
print("Function: \(#function), line: \(#line)")
guard let session = pairedSession(of:action.callUUID) else {
action.fail()
return
}
let callUpdate = CXCallUpdate()
callUpdate.remoteHandle = action.handle
callUpdate.hasVideo = true
callUpdate.localizedCallerName = callDetails.dispalyName;
callUpdate.supportsDTMF = false
provider.reportCall(with: action.callUUID, updated: callUpdate)
delegate?.callCenter(self, startCall: session)
action.fulfill()
}
你也可以在这里参考我的帖子。 https://stackoverflow.com/questions/54197721/how-to-integrate-callkit-with-agora-voip-in-swift-4-ios/54647666#54647666