Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when i click on notification it redirects to home screen not showing full screen intent call pickup screen #127

Open
navaghandabhi opened this issue Dec 18, 2023 · 8 comments

Comments

@navaghandabhi
Copy link

navaghandabhi commented Dec 18, 2023

when i click on notification it redirects to home screen not showing full screen intent call pickup screen if i click on notification in background or foreground its not redirecting to call pickup screen its moving to home screen and when i accept call then i want to redirect call screen but without context not moving to particular screen

@TatankaConCube
Copy link
Contributor

please review other issues to search for the solution to your problem before creating a new one, here is a similar ticket, and here is a solution

@navaghandabhi
Copy link
Author

navaghandabhi commented Dec 19, 2023

please review other issues to search for the solution to your problem before creating a new one, here is a similar ticket, and here is a solution

thank you
now i am able to accept or reject call ...
but when i click on notification before accept or reject call it redirects to home screen not showing full screen intent call pickup screen

@TatankaConCube
Copy link
Contributor

the plugin doesn't know anything about your app and doesn't know what screen it should navigate to. you need to check the state of the call on your app start and if the state is the CallState.PENDING it means the call is still awaiting the action from the user and you should navigate to the Incoming screen inside your app.

@navaghandabhi
Copy link
Author

navaghandabhi commented Dec 19, 2023

No, I don't want to navigate to the app screen. I want to go to the call pick-up screen, which is the full-screen notification that appears on the lock screen on Android. coming from the package like WhatsApp

@TatankaConCube
Copy link
Contributor

no, it is impossible in the current realization. you can try to implement this by yourself by replacing the intent on the select notification action, change the value of this pendingIntent to the intent for running the fullscreen intent from this part

@kzawadi
Copy link

kzawadi commented May 19, 2024

@navaghandabhi
Hi hello. did you succeed in implementing this?.

@navaghandabhi
Copy link
Author

navaghandabhi commented May 21, 2024

@navaghandabhi Hi hello. did you succeed in implementing this?.
yes, please check this code

  CallEvent callEvent = CallEvent(
      sessionId: sessionId,
      callType: payload["type"] == "Voice" ? 0 : 1,
      callerId: 1,
      callerName: name,
      opponentsIds: const {0, 1},
      callPhoto: userData.photo,
      userInfo: {
        'userData': jsonEncode(userData.toMap()),
        'callId': sessionId,
        'channelName': payload["channelName"],
        'type': payload["type"],
      });
  ConnectycubeFlutterCallKit.showCallNotification(callEvent);
  void initCallKit() {
  Future<void> onCallAccepted(CallEvent callEvent) async {
    WidgetsFlutterBinding.ensureInitialized();
    try {
      Map<String,String> payload = callEvent.userInfo!;
      print("payload : $payload");
      if (payload["type"] == "Voice") {
        Get.to(() => VoiceCallView(callId: payload["callId"]!, remoteUserData: UserData.fromJson(json.decode(payload["userData"]!) as Map), isStartCall: true, isFromCall: true));
      } else if (payload["type"] == "Video") {
        Get.to(() => VideoCallView(remoteUserData: UserData.fromJson(json.decode(payload["userData"]!)), callId: payload["callId"]!, isFromCall: true, isStartCall: true));
      } else {
        print("call type : ${payload["type"]}");
      }
    } catch (error) {
      print("answerCall ERROR : $error");
    }
  }

  Future<void> onCallRejected(CallEvent callEvent) async {
    FirebaseDatabase.instance.ref("CallHistory").child(callEvent.userInfo!["callId"]!).update({"endAt": DateTime.now().toString(), "status": "Rejected"});
  }

  ConnectycubeFlutterCallKit.instance.init(onCallAccepted: onCallAccepted, onCallRejected: onCallRejected);
}
  

@kzawadi
Copy link

kzawadi commented May 24, 2024

@navaghandabhi Hi hello. did you succeed in implementing this?.
yes, please check this code

  CallEvent callEvent = CallEvent(
      sessionId: sessionId,
      callType: payload["type"] == "Voice" ? 0 : 1,
      callerId: 1,
      callerName: name,
      opponentsIds: const {0, 1},
      callPhoto: userData.photo,
      userInfo: {
        'userData': jsonEncode(userData.toMap()),
        'callId': sessionId,
        'channelName': payload["channelName"],
        'type': payload["type"],
      });
  ConnectycubeFlutterCallKit.showCallNotification(callEvent);
  void initCallKit() {
  Future<void> onCallAccepted(CallEvent callEvent) async {
    WidgetsFlutterBinding.ensureInitialized();
    try {
      Map<String,String> payload = callEvent.userInfo!;
      print("payload : $payload");
      if (payload["type"] == "Voice") {
        Get.to(() => VoiceCallView(callId: payload["callId"]!, remoteUserData: UserData.fromJson(json.decode(payload["userData"]!) as Map), isStartCall: true, isFromCall: true));
      } else if (payload["type"] == "Video") {
        Get.to(() => VideoCallView(remoteUserData: UserData.fromJson(json.decode(payload["userData"]!)), callId: payload["callId"]!, isFromCall: true, isStartCall: true));
      } else {
        print("call type : ${payload["type"]}");
      }
    } catch (error) {
      print("answerCall ERROR : $error");
    }
  }

  Future<void> onCallRejected(CallEvent callEvent) async {
    FirebaseDatabase.instance.ref("CallHistory").child(callEvent.userInfo!["callId"]!).update({"endAt": DateTime.now().toString(), "status": "Rejected"});
  }

  ConnectycubeFlutterCallKit.instance.init(onCallAccepted: onCallAccepted, onCallRejected: onCallRejected);
}
  

@navaghandabhi Hi hello. did you succeed in implementing this?.
yes, please check this code

  CallEvent callEvent = CallEvent(
      sessionId: sessionId,
      callType: payload["type"] == "Voice" ? 0 : 1,
      callerId: 1,
      callerName: name,
      opponentsIds: const {0, 1},
      callPhoto: userData.photo,
      userInfo: {
        'userData': jsonEncode(userData.toMap()),
        'callId': sessionId,
        'channelName': payload["channelName"],
        'type': payload["type"],
      });
  ConnectycubeFlutterCallKit.showCallNotification(callEvent);
  void initCallKit() {
  Future<void> onCallAccepted(CallEvent callEvent) async {
    WidgetsFlutterBinding.ensureInitialized();
    try {
      Map<String,String> payload = callEvent.userInfo!;
      print("payload : $payload");
      if (payload["type"] == "Voice") {
        Get.to(() => VoiceCallView(callId: payload["callId"]!, remoteUserData: UserData.fromJson(json.decode(payload["userData"]!) as Map), isStartCall: true, isFromCall: true));
      } else if (payload["type"] == "Video") {
        Get.to(() => VideoCallView(remoteUserData: UserData.fromJson(json.decode(payload["userData"]!)), callId: payload["callId"]!, isFromCall: true, isStartCall: true));
      } else {
        print("call type : ${payload["type"]}");
      }
    } catch (error) {
      print("answerCall ERROR : $error");
    }
  }

  Future<void> onCallRejected(CallEvent callEvent) async {
    FirebaseDatabase.instance.ref("CallHistory").child(callEvent.userInfo!["callId"]!).update({"endAt": DateTime.now().toString(), "status": "Rejected"});
  }

  ConnectycubeFlutterCallKit.instance.init(onCallAccepted: onCallAccepted, onCallRejected: onCallRejected);
}
  

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants