How to auto join meeting on answer call when the iPhone is locked (like in Whatsapp)?
Current Flow:
When answer call, the meeting not yet joined.
It should have been able to join when I answer the call even I haven't clicked the icon (jitsi_meet_example)
When click app icon (jitsi_meet_example), and it joins the meeting.
Code Below
in AppDelegate:
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate, JMCallKitListener {
//var jitsiViewController: JitsiViewController?
var flutterResult: FlutterResult?
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
) -> Bool {
GeneratedPluginRegistrant.register(with: self)
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let CHANNEL = FlutterMethodChannel(name: "com.flutter.callkit/callkit", binaryMessenger: controller.binaryMessenger)
CHANNEL.setMethodCallHandler { [unowned self] (methodCall, result) in
if methodCall.method == "callkit" {
guard let args = methodCall.arguments else { return }
let myArgs = args as? [String: Any]
let strUuid = myArgs?["uuid"] as? String
let strHandle = myArgs?["handle"] as? String
let strDisplayName = myArgs?["displayName"] as? String
let boolHasVideo = myArgs?["hasVideo"] as? Bool
let uuid = UUID(uuidString: strUuid!) ?? UUID()
print("real",uuid)
let backgroundTaskIdentifier =
UIApplication.shared.beginBackgroundTask(expirationHandler: nil)
//guard !JMCallKitProxy.hasActiveCallForUUID(uuid.uuidString) else { return }
JMCallKitProxy.enabled = true
//guard JMCallKitProxy.hasActiveCallForUUID(uuid.uuidString) else { return }
configureAudioSession()
JMCallKitProxy.configureProvider(localizedName: "Testing SDK", ringtoneSound: nil, iconTemplateImageData: nil)
DispatchQueue.main.asyncAfter(deadline: .now() + 5.0) {
JMCallKitProxy.reportNewIncomingCall(UUID: uuid, handle: strHandle, displayName: strDisplayName, hasVideo: boolHasVideo!, completion: {
(error) in UIApplication.shared.endBackgroundTask(backgroundTaskIdentifier)
})
}
//result("Hi, your request has successfull")
JMCallKitProxy.addListener(self)
flutterResult = result
}
}
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}
func configureAudioSession() {
let session = AVAudioSession.sharedInstance()//AVAudioSession.sharedInstance()
do {
try session.setCategory(.playAndRecord)
try session.setMode(.voiceChat)
try session.setActive(true)
} catch let error {
Swift.print("configureAudioSession error: \(error)")
}
}
func performAnswerCall(UUID: UUID) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1.0) {
self.flutterResult!("gettoken")
}
print("performAnswerCall: \(UUID.uuidString)")
}
How to auto join meeting on answer call when the iPhone is locked (like in Whatsapp)?
Current Flow: When answer call, the meeting not yet joined. It should have been able to join when I answer the call even I haven't clicked the icon (jitsi_meet_example)
When click app icon (jitsi_meet_example), and it joins the meeting.
Code Below
in AppDelegate:
in Dart: