voximplant / flutter_callkit

Flutter SDK for CallKit integration to Flutter applications on iOS
MIT License
53 stars 18 forks source link

Call Processing on Locked Screen #4

Closed kostasoft closed 3 years ago

kostasoft commented 3 years ago

Hello. Tell us how to make the application on Flutter run when the phone is locked? After the user made a pile on the slider and worked out the method "performAnswerCallAction". In my case, if the phone is not locked, then even if the application is killed from memory, after the answer to the call the application will start and process the incoming call. All processing is based on WebRTC technology and written in Flutter. But if the phone is locked, then after the answer to an incoming call the only way to start the application is to press the custom button, enter the unlock code of the screen and only then the application will start. Is it possible to start the application somehow in the background in the "performAnswerCallAction" handler or even earlier in the "didReceiveIncomingPushWithPayload" handler?

YuliaGrigorieva commented 3 years ago

Hello @kostasoft ,

When the CallKit incoming call screen is shown to a user, the application is already running. It means that the application UI may not be shown to a user (in the lock mode), but you can establish a call and manage it.

It is required to unlock the phone to show the application UI, it can't be changed due to Apple restrictions.

To make application responsive to user actions including CallKit buttons, you need to move all code that manages a call to non-widget class. This way you will be able to establish the call even the app is in the background or covered by CallKit UI.

I recommend to take a look at the video call demo app for Voximplant Flutter SDK, it contains CallService and CallKitService that are UI independent: https://github.com/voximplant/flutter_demos/blob/master/video_call/lib/services/call/call_service.dart https://github.com/voximplant/flutter_demos/blob/master/video_call/lib/services/call/callkit_service.dart

It is also worth to check that the background modes are enabled in the iOS Xcode project.

Best regards, Yulia Grigorieva

kostasoft commented 3 years ago

Thank you so much for your help, Yulia! You have explained everything in great detail and are available. And also with a link to the code! Thank you very much!

VelayuthamM commented 3 years ago

@kostasoft Is this really working? I have used the same code but got the issue.

rekonvald commented 3 years ago

Can't we use FCM background message handler for showing incoming call?

kevinarch commented 3 years ago

Can't we use FCM background message handler for showing incoming call?

I'm having the same problem. FCM background message handler will run in another isolate. I don't how to solve this. @kostasoft Can you help us what should I do in this case ?