connectycube-flutter-samples icon indicating copy to clipboard operation
connectycube-flutter-samples copied to clipboard

onConnectedToUser is not being excuted

Open kzawadi opened this issue 1 year ago • 3 comments
trafficstars

So I have a stateful widget and it implements the RTCSessionStateCallback<P2PSession> and so overrides all the methods. but the onConnectedToUser is not getting executed when I answer the call from Callkit. This happens on ios and I am on ios 18

[] Chat sample [x] P2P Calls sample [] Conference Calls sample

Platform (use [x]) [] Android [x] iOS [] macOS [] Windows [] Web [] Linux

Device info Manufacturer: Apple Model: 13 pro max OS version: 18.1

Describe the bug: So I have a stateful widget and it implements the RTCSessionStateCallback<P2PSession> and so overrides all the methods. but the onConnectedToUser is not getting executed when I answer the call from Callkit. This happens on ios and I am on ios 18

Steps to Reproduce:

  1. conversation page try to log something on the method onConnectedToUser
  2. get a call
  3. answer using call kit when your have locked the phone

Logs:

log here

or Gist log

Actual result:

Expected behaviour: A callback should execute the logic I have on that callback method

Additional info Add any other context about the problem here.

kzawadi avatar Oct 22 '24 09:10 kzawadi

Hello @kzawadi. Did you reproduce this issue on P2P Calls sample? Does 'onConnectedToUser' execute in it? Also you can check if this works on android platform.

CubeRomanMagellan avatar Oct 23 '24 16:10 CubeRomanMagellan

On Android, it works fine. Yes i am using p2p call sample

And on ios

SO here I attach two screen recordings of the two scenarios and the code

So in the ConversationCallScreen page which implements implements RTCSessionStateCallback<P2PSession> which now as sample p2p will have two override some callback methods. amoung them being @override void onConnectedToUser(P2PSession session, int userId) async {

And in this callback is where I have some logic like starting the timer and other call information stuff

So when the app is in foreground it works flawless but in iOS when I answer the call in callKit. and click the app icon in callKit it opens the app as anticipated and navigate to conversationpage but the callback method onConnectedToUser is not executed.

This is where I have the app working. (Answering the app when it is not locked). https://we.tl/t-LijZuix0Oy

And is the case in which the callback method is not getting executed/called as you see the logic to start the timer is not working and no breakpoint will get caught here in this scenario https://we.tl/t-1yOdl39AAv

And here are other working scenarios just for reference https://we.tl/t-cDGuafHKc0

Screenshot 2024-10-23 at 20 42 45
@override
void onConnectedToUser(P2PSession session, int userId) async {
  log("onConnectedToUser userId= $userId");
  _timerService.reset();
  _timerService.start();
  initForegroundServices();
  FlutterRingtonePlayer().stop();
  if (_isIncoming) {
    setState(() {
      callInfo = "Incoming call";
    });
  } else {
    setState(() {
      callInfo = "Outgoing call";
    });
  }
}







kzawadi avatar Oct 23 '24 17:10 kzawadi

If onConnectedToUser is not called, means connection with call opponent is not established by some reasons.

Check all steps when accept call, and in CallManager CallState.ACCEPTED is need to be.

Also please review other issues to search for the solution to your problem https://github.com/ConnectyCube/connectycube-flutter-call-kit/issues/116 is a similar ticket, and https://github.com/ConnectyCube/connectycube-flutter-call-kit/issues/116#issuecomment-1822399414 is a solution.

CubeRomanMagellan avatar Oct 24 '24 21:10 CubeRomanMagellan

Let me check these once again and I will report back

kzawadi avatar Oct 27 '24 17:10 kzawadi