I am currently working on Agora.io services which give us
audio,video,one-to-one and broadcast communication
I have successfully implemented these with the help of there given samples, and successfully add signalling module.
Problem is that signalling call must be active to access all features of it now I want to access all features of signalling at the time when app is closed like whatsapp and other these type of application one solution is make a service of signalling class but this is not professional solution.
I want efficient one solution
This cannot be done with any 3rd party APIs. This is a system level functionality offered by Apple & Google. You will have to use CallKit (for iOS) or ConnectionService (for Android) to achieve this functionality.
I have done exactly the same thing a few days ago.
For iOS, you have use PushKit and CallKit in the following ways:-
.1. Enable background mode and also check voip.
- Import Pushkit and implement PKPushRegistryDelegate functions.
Register pushkit like this :-
func registerPushkitToken() -> Void {
pushRegistry = PKPushRegistry.init(queue: DispatchQueue.main)
pushRegistry?.delegate = self
pushRegistry?.desiredPushTypes = [.voIP]
}
3.Implement the token fuction
func pushRegistry(_ registry: PKPushRegistry, didUpdate pushCredentials:
PKPushCredentials, for type: PKPushType) {
let tokenChars = pushCredentials.token.hexString()
}
Implement the following function for parsing notification
func pushRegistry(_ registry: PKPushRegistry, didReceiveIncomingPushWith payload: PKPushPayload, for type: PKPushType) {
if let userInfo = payload.dictionaryPayload["userInfo"] as? [AnyHashable:Any]{
}
}
Implement provider delegate functions:
let providerConfiguration = CXProviderConfiguration(localizedName: appName)
providerConfiguration.supportsVideo = true
providerConfiguration.maximumCallsPerCallGroup = 1
providerConfiguration.maximumCallGroups = 1
providerConfiguration.supportedHandleTypes = [.generic]
Implement CXProviderDelegate functions
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()
}
You can also refer to my post here. https://stackoverflow.com/questions/54197721/how-to-integrate-callkit-with-agora-voip-in-swift-4-ios/54647666#54647666