flutter_callkit_incoming: I can`t accept call when app terminated
Hi. My app is working on foreground and background. When app is terminated state or not running, I see the incoming call notification but when I tap the accept button the app starts but does not go to the call screen
Debug consule : Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter_callkit_incoming_events. Response ID: 21
Event Code :
FlutterCallkitIncoming.onEvent.listen((event) async {
switch (event!.event) {
case Event.ACTION_CALL_INCOMING:
print(event.body['extra']['roomID']);
break;
case Event.ACTION_CALL_START:
// TODO: started an outgoing call
// TODO: show screen calling in Flutter
break;
case Event.ACTION_CALL_ACCEPT:
navigatorKey.currentState?.push(
MaterialPageRoute(
builder: (context) =>
CallPage(callID: event.body['extra']['roomID']),
),
);
break;
case Event.ACTION_CALL_DECLINE:
// TODO: declined an incoming call
break;
case Event.ACTION_CALL_ENDED:
// TODO: ended an incoming/outgoing call
break;
case Event.ACTION_CALL_TIMEOUT:
// TODO: missed an incoming call
break;
case Event.ACTION_CALL_CALLBACK:
// TODO: only Android - click action `Call back` from missed call notification
break;
case Event.ACTION_CALL_TOGGLE_HOLD:
// TODO: only iOS
break;
case Event.ACTION_CALL_TOGGLE_MUTE:
// TODO: only iOS
break;
case Event.ACTION_CALL_TOGGLE_DMTF:
// TODO: only iOS
break;
case Event.ACTION_CALL_TOGGLE_GROUP:
// TODO: only iOS
break;
case Event.ACTION_CALL_TOGGLE_AUDIO_SESSION:
// TODO: only iOS
break;
case Event.ACTION_DID_UPDATE_DEVICE_PUSH_TOKEN_VOIP:
// TODO: Handle this case.
break;
case Event.ACTION_CALL_CUSTOM:
// TODO: Handle this case.
break;
}
});
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 16 (1 by maintainers)
Yes, I solved it. First, tap the accept button of the terminated app. After opening the app, I check the active calls and if there is an active call, I decode it to json and go to the call screen
It works for me @Mfolio. thank you so much.
I still receive a duplicated call on the Android, when I pick up the call in the first 1-2 seconds. Do you have any idea to fix the duplication?
Just endActiveCalls every hangup
@Mfolio Have you solved this?
Same issue here, it only happens to Android/Huawei when terminated,
@booooohdan suggests using
@pragma('vm:entry-point'), it seems that it doesn’t work for me because I am using OneSignal, not Firebase. OneSignal do not have a so-calledbackgroundHandlerfunction, so a customNotificationServiceExtensionis needed to intercept the notification and show the call dialog.Everything was working perfectly fine before, but now I’m not sure what happened and it’s not working again.
I am currently using:
So the issue for me is that I use the
showIncomingNotificationfunction in native android (Kotlin) whenever a “call” notification is received as such:It works when the app is in foreground/background, but when the app is terminated the call dialog is not shown. So I assumed there’s something to do with the
contextbeing null. So I “fix” it by manually creating the intent and passing the context as such:So the above code will show the call dialog when the app is terminated, however when I tap on
DeclineorAccept, theFlutterCallkitIncoming.onEvent.listenis not working, it is not receiving any event.Anyone can help? @hiennguyen92
I can confirm this code worked previously, but I do not know what changed, Flutter’s new version? Would be great to have an update about this.