Closed alito0697 closed 5 months ago
it is expected behavior for this plugin, the callback onCallAcceptedWhenTerminated
will be called if the app is killed or is in the background, and then launched the app. If you found another behavior, please describe how we can reproduce it on our side and share the logs related to this issue. Also, you can try our P2P Calls sample where this plugin works well.
So i can't execute joinmeeting() method when the app is terminated ?? How can i do that ??
have you seen our example? we use the callback onCallRejectedWhenTerminated
there which works well in our example. the method onCallRejectedWhenTerminated
works in the same way as onCallAcceptedWhenTerminated
inside the plugin and if you did it in the same way as in our example the callback onCallAcceptedWhenTerminated
should work for you
please could you provide a code example or at least try to correct the issue in my code
some recommendations:
onCallAcceptedWhenTerminated
should be a separate function that doesn't relate to any class;
try to add logs on every step of your app after starting till calling the callbacks and check where the plugin's work stucks.W/ConnectycubeFlutterBgPerformingService( 8370): A background message could not be handled in Dart as no onBackgroundMessage handler has been registered
according to the error, it looks like you haven't set onCallRejectedWhenTerminated
or onCallAcceptedWhenTerminated
before
I did as you see above but is it in the wrong place ?
could you please format your code? now is not understandable where ends the function videocaller
and where it is placed
sorry it's little bit too long
` videocaller()async{
Uuid uuid = Uuid();
SharedPreferences prefs = await SharedPreferences.getInstance();
dynamic username = prefs.getString("username");
CallEvent callEvent = CallEvent(sessionId: uuid.v4() ,callType: 0, callerId: 2, callerName: username, opponentsIds:{1234});
Future _onCallAccepted(CallEvent callEvent) async { _joinMeetingVideo(); }
Future _onCallRejected(callEvent) async {
} Future onCallRejectedWhenTerminated(CallEvent callEvent) async { print("reject call"); } Future onCallAcceptedWhenTerminated(CallEvent callEvent) async { _joinMeetingVideo(); } ConnectycubeFlutterCallKit.onCallRejectedWhenTerminated = onCallRejectedWhenTerminated; ConnectycubeFlutterCallKit.onCallAcceptedWhenTerminated = onCallAcceptedWhenTerminated; ConnectycubeFlutterCallKit.instance.init( onCallAccepted: _onCallAccepted, onCallRejected: _onCallRejected, ); ConnectycubeFlutterCallKit.showCallNotification(callEvent); ConnectycubeFlutterCallKit.setOnLockScreenVisibility(isVisible: true); }
onMessage() { var i =0; FirebaseMessaging.onMessage.listen((RemoteMessage message)async { RemoteNotification? notification = message.notification; var filter = message.data; var j = i++; if(filter["type"] == "message"){
AwesomeNotifications().createNotification(
content: NotificationContent(
autoDismissible: true,
wakeUpScreen: true,
id: j,
channelKey: 'basic_channel',
title: "Hedylogos Call",
body: notification?.body
));
} if(filter["type"] == "call"){ caller(); } if(filter["type"] == "videocall"){ videocaller();
} } ); }
Future
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
// BackgroundFetch.registerHeadlessTask(backgroundFetchHeadlessTask);
AwesomeNotifications().initialize( // set the icon to null if you want to use the default app icon "", //'resource://drawable/res_app_icon', [ NotificationChannel( playSound: true, icon: null, channelGroupKey: 'basic_channel_group', channelKey: 'basic_channel', channelName: 'Basic notifications', channelDescription: 'Notification channel for basic tests', defaultColor: Color(0xFF9D50DD), ledColor: Colors.white) ], // Channel groups are only visual and are not required channelGroups: [ NotificationChannelGroup( channelGroupKey: 'basic_channel_group', channelGroupName: 'Basic group') ], debug: true);
FirebaseMessaging.onBackgroundMessage(_firebaseMessagingBackgroundHandler);
FirebaseMessaging _fcm = FirebaseMessaging.instance; permi(_fcm); checkprm(_fcm); FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding); runApp(const MyApp()); }`
please read the markdown documentation and format it, use the Preview
tab to see how your message will look after sending it
@TatankaConCube
final CallbackHandle userHandle = PluginUtilities.getCallbackHandle(handler)!;
I'm getting an error at this line of code in connectycube_flutter_callkit.dart file which is Null check operator used on a null value
can you at least help to change the code of the plugin to execute a specific method while the app is in the background or in terminated mode
@alito0697 the annotation @pragma('vm:entry-point')
for your handlers may help you to resolve your issue, please try to mark your handlers with this annotation
no activity for a long time, closing
` videocaller()async{ Uuid uuid = Uuid(); SharedPreferences prefs = await SharedPreferences.getInstance(); dynamic username = prefs.getString("username"); CallEvent callEvent = CallEvent(sessionId: uuid.v4() ,callType: 0, callerId: 2, callerName: username, opponentsIds:{1234});
Future _onCallAccepted(CallEvent callEvent) async {
_joinMeetingVideo();
}
Future _onCallRejected(callEvent) async {
} Future onCallRejectedWhenTerminated(CallEvent callEvent) async { print("reject call"); } Future onCallAcceptedWhenTerminated(CallEvent callEvent) async {
_joinMeetingVideo();
}
ConnectycubeFlutterCallKit.onCallRejectedWhenTerminated = onCallRejectedWhenTerminated;
ConnectycubeFlutterCallKit.onCallAcceptedWhenTerminated = onCallAcceptedWhenTerminated;
ConnectycubeFlutterCallKit.instance.init(
onCallAccepted: _onCallAccepted,
onCallRejected: _onCallRejected,
);
ConnectycubeFlutterCallKit.showCallNotification(callEvent);
ConnectycubeFlutterCallKit.setOnLockScreenVisibility(isVisible: true);
}`
accept button launches the app when the app is terminated instead of executing the method _joinMeetingVideo()