代码之家  ›  专栏  ›  技术社区  ›  Asadullah Mumtaz

在应用程序关闭时实施Agora信号以进行通信

  •  3
  • Asadullah Mumtaz  · 技术社区  · 7 年前

    我目前正在 阿格拉。io 为我们提供的服务

    音频、视频、一对一和广播通信

    在这些给定示例的帮助下,我成功地实现了这些功能,并成功地添加了信令模块。 问题是信令呼叫必须处于活动状态才能访问它的所有功能现在我想在应用程序关闭时访问信令的所有功能,如whatsapp和其他此类应用程序一种解决方案是提供信令类服务,但这不是专业解决方案。

    我想要一个高效的解决方案

    2 回复  |  直到 7 年前
        1
  •  3
  •   Sidharth Sharma    7 年前

    任何第三方API都无法做到这一点。这是Apple&提供的系统级功能;谷歌。您必须使用CallKit(用于iOS)或ConnectionService(用于Android)来实现此功能。

        2
  •  2
  •   Protocol    6 年前

    几天前我也做了同样的事情。

    对于iOS,您可以通过以下方式使用PushKit和CallKit:-

    .1、启用后台模式,同时检查voip。

    You dont have to check Audio option necessarily

    1. 导入Pushkit并实现PKPushRegistryDelegate函数。

    按如下方式注册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()
     }
    
    1. 为解析通知实现以下功能

      func pushRegistry(\uRegistry:PKPushRegistry,didReceiveIncomingPushWith payload:PKPushPayload,for type:PKPushType){ 如果让userInfo=有效负载。dictionaryPayload[“userInfo”]作为?[任意哈希:任意]{ } }

    2. 实现提供程序委托功能:

      让providerConfiguration=CXProviderConfiguration(本地化名称:appName) providerConfiguration。supportsVideo=真 providerConfiguration。maximumCallsPerCallGroup=1 providerConfiguration。maximumCallGroups=1 providerConfiguration。supportedHandleTypes=[.通用]

    实施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()
        }
    

    你也可以参考我在这里的帖子。 how to integrate Callkit with Agora VOiP in swift 4 iOS?